passing a variable to a ajax request Jquery

Posted by user304735 on Stack Overflow See other posts from Stack Overflow or by user304735
Published on 2010-03-30T02:14:22Z Indexed on 2010/03/30 2:23 UTC
Read the original article Hit count: 395

Filed under:
|
|
|

Hello, I am trying to pass a variable to an ajax request via jquery. I have a triggered event that defines the variable. I want to do this so that I can have one ajax request handle multiple urls. I have alerted the url and it come back fine, but when I plug it into the URL slot of a $.ajax request my targeted content does not load. Here is my code.

$(document).ready(function(){

   $('a').live('click', function(){
      var link = $(this).attr("href");
       $.ajax({
           url: link,
           success: function(html){
                $('#load').html(html)
           }
      });
   });

});

this has been a real headache and I feel I am just misusing something. Please help.

© Stack Overflow or respective owner

Related posts about AJAX

Related posts about jQuery