0

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

3
  • could you post the error you get? Commented Apr 21, 2010 at 10:09
  • How do I get what the error is? Commented Apr 21, 2010 at 10:20
  • use firebug to see the error, open its console and try to submit the form. The error will be displayed in firebug console. Commented Apr 21, 2010 at 10:45

1 Answer 1

4

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.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks for your response, Yes the URL i'm sending to is on a different server than the one I'm making the call from. How would I achieve the results I'm after?
Probocop, submit it server-side. Your ajax submit it to php/servlet/cgi, and then php/servlet submit it to the intended server.
That's exactly what I've just ended up doing :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.