I am still in the same problem in this link here. So, I used the append
method. And here is the AJAX
code:
Try changing your data in ajax to this
data: {'insert_new': 'insert_new', 'selectW': selectW, 'select_at': select_at, 'pay': pay, 'facture': facture, 'select_opt': select_opt},
You are not getting any value because your data variable does't match with the $_request[] variables
please correct your json data which you are sending to server
data: {'insert_new': 1, 'selectW': selectW, 'select_at': select_at, 'pay': pay, 'facture': facture, 'select_opt': select_opt},
and in php add a die
if(isset($_REQUEST['insert_new'])){
// your code
die(); // just before closing the if to make sure you are not echoing anything more;
}
[1] Why are you catching value
of a button
var selectW = $('#insert_new').val();
I think there is no need for that.
[2] Add this before ajax
call
dataString = 'selectW='+ selectW + '&select_at='+ select_at + '&pay='+ pay+ '&facture='+facture+ '&select_opt='+ select_opt;
[3] In ajax
call set `data' as
data: dataString,
instead of
data: {'text': insert_new, 'text': selectW, 'text': select_at, 'text': pay, 'text': facture, 'text': select_opt},
[4] Why are you catching response
, you are not sending any string
back from insert_buy.php
if(response=="success")
{
as you are not getting return value
as "success"
, else
part is getting executed and getting alert
message as "No data added".