Jquery Ajax - Submitting form with ajax not working
I have a form which on submit I want to run a script via Ajax, but for some reason it is returning an error. Any idea what is wrong? My code is as following:
$('.spiderform').submit(function (event) {
event.preventDefault();
alert($(this).serialize());
$.ajax({
type: 'get',
开发者_开发技巧 url: 'http://spidertest.epiphanydev1.co.uk/spider/?'+$(this).serialize(),
beforeSend: function() {
alert('sending form');
},
success: function() {
alert('worked');
},
error: function(jon) {
alert('error');
}
});
});
Thanks
Since you haven't given any idea what error is is, but since you have an absolute URI in there, I'd guess you are running into the Same Origin Policy.
精彩评论