开发者

Jquery Ajax - Submitting form with ajax not working

开发者 https://www.devze.com 2022-12-27 11:19 出处:网络
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:

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消