php - $.ajax post not working properly -
i trying ajax request using jquery using following code:
$.ajax({ type: 'post', url: './ajax/mostra_duv.php', data: 'pag=1&teste=deu', cache: false, contenttype: false, processdata: false }) .done(function(data) { if(data!='') { $("#resumoduvida").html(data); } else { $("#resumoduvida").html('<p>desculpe, houve um problema na conexão ao servidor. tente novamente</p>'); } }) .fail(function() { $("#resumoduvida").html('<p>desculpe, houve um problema na conexão ao servidor. tente novamente</p>'); }); then, mostra_duv.php calling print_r($_post); resulting in empty array...
i expect $_post['pag'] , $_post['teste'] values corresponding request (respectively 1 , 'deu').
any appreciated! thanks!
just simple code deal point.
$.ajax({ type: 'post', url: 'pagetoyourscript.php', data: {page: 1, test: 'test'}, success: function(data){ console.log(data); }, error: function(jqxhr){ console.log(jqxhr); } }); change values, , handle returned data or error if there is.
Comments
Post a Comment