Wednesday, 15 July 2015

javascript - Transfering data via ajax to php -


First of all, thanks for answering. I solve the problem with the format, but I have a new problem in the transfer of data by AJAX in my php.

Ajax sends data like this:

  $ Ajax ({Url: 'http: //localhost/test-fullcalendar/php/add_evento.php', data: 'title =' + title + 'and start =' + start + '& end =' + End, type: "post", success: function (jsn) {warning ('ok');}}); Received like  

and add_evento.php:

  $ title = $ _ POST ['title']; $ = $ _ Post ['start'] start; $ End = $ _ post ['end'];  

It says 'undefined index' in all the variables, so I included 'isset' to anyone. After this I echoed the variable and nobody got the data correctly, everyone did not show anything. I try to change the data line to:

  data: {title: title, start: start, end: end},  

and method To get the post and still not working

How can I see how I am sending data correctly? Im writing alerts (datatylet); Do not show anything inside the AJAX function

Your data is incorrect Try it:

< Pre> $ Ajax ({url: 'http: //localhost/test-fullcalendar/php/add_evento.php', data: {"title": title, "start": start, "end": end}, type: "post ", Success: function (jsn) {alert ('ok' ;;}}; if type:" POST " you can access data with $ _ POST And if you can access type: "GET" code> with $ _ GET


No comments:

Post a Comment