jquery, ajax, load post result to div

Posted by mike on Stack Overflow See other posts from Stack Overflow or by mike
Published on 2010-06-11T16:16:48Z Indexed on 2010/06/11 16:22 UTC
Read the original article Hit count: 167

Filed under:
|
|

Hello,

I have a form that I need to post and show the result in a div. I'm not having any problems making the ajax call but I can't seem to figure out how to load the result to a div. I have tried:

$.ajax({
    type: 'POST',
    data: $('#someForm').serialize(),
    url: 'http://somedomain.com/my/url',
    success: function(data) {   
        $('#someDiv').load(data);
    }
});

but it does not seem to work properly. I'm nit sure if this should even work but the result is the the page i'm posting from being loaded into the div and not the url I'm posting to.

Any help would be great! Thanks!

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery