javascript - Why does Ajax post data to localhost rather than the provided URL? -
so using ajax post form server, however, instead of sending form url, sends itself.
here code
$("#psignup").click(function() { $.ajax({ type: "post", url: "example/default/mobile_user_register", data: $("#patientsignup").serialize(), // serializes form's elements. success: function(data) { alert(data); // show response php script. } }); return false; // avoid execute actual submit of form. });
in browser, appears send http://localhost:8080/?email=asdfa%40asd.com&password=asd&repeatpassword=&firstname=asd&username=&lastname=asd
what looking is, of course, "http://example.com/default/mobile_user_register?xxxxxxxxxxxxxx". can me understand why isn't working?
use jsonp
$.ajax({ url: "http://example.com/default/mobile_user_register?xxxxxxxxxxxxxx", datatype: 'jsonp', //use jsonp data type in order perform cross-domain ajax crossdomain: true, data: data, success: callback, error: callback });
Comments
Post a Comment