jQuery ajax post dynamic url insertion

Posted by Kirill on Stack Overflow See other posts from Stack Overflow or by Kirill
Published on 2010-05-28T09:42:21Z Indexed on 2010/05/28 9:51 UTC
Read the original article Hit count: 331

Filed under:
|
$.ajax({ type: "POST", url: "OMFG.php", data: info, success: function(){ }});

is what I'm using atm as a test and it works fine.

I need to get the url from the link I'm clicking, so I do:

var url = $(this).attr("href");

which works fine if I alert it out(the link includes http://samedomain.com/etc.php), but the ajax function doesn't post if I insert it into the ajax code:

$.ajax({ type: "POST", url: url, data: info, success: function(){ }});

Please help, as I'm screwed without this working.

© Stack Overflow or respective owner

Related posts about php

Related posts about jQuery