Skip to content Skip to sidebar Skip to footer

Jquery / Ajax Form - Serverside Php But Get Cross Domain Warning

I'm stuck at this problem half the day and i'm totally out of options now. I have a form that is submitted via a click handler to a php script that is in the SAME directory BUT ev

Solution 1:

ajax response has indicate your server script is error, and yes your php script has error in line 2.. you missed one closing ) in if statement..

if (isset($_POST['lastname'],$_POST['firstname'] ,$_POST['email']) { 

to

if (isset($_POST['lastname'],$_POST['firstname'] ,$_POST['email'])) {

Solution 2:

My Chrome Dev Tools kept activating breakpoints with every XHR request to server side php.

Short answer - Sources tab, uncheck XHR Breakpoints - Any XHR (at right)

Long answer (why this answer belongs here)

I incorrectly thought it was a cross domain issue because:

  • The console kept referencing jquery.js:8630
  • xHR obj in the console has this property: n.ajaxTransport.k.cors.a.crossDomain.send
  • All web searches pointed to cross domain issues.

Hope this helps someone!

Post a Comment for "Jquery / Ajax Form - Serverside Php But Get Cross Domain Warning"