code_junkie

JQuery Passing Variable From href to load()

Nov 14th, 2011
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. $(document).ready(function()
  2. {
  3. $(".add_to_favorites").livequery("click", function(event)
  4. {
  5. var add_id = this.id.replace("add_", ""); //taken from a.href tag
  6. alert (id);
  7. $.get(this.href, function(data)
  8. {
  9. $("#refreshme_"+add_id).load("http://www.example.com/car_list/"+add_id);
  10.  
  11. <a class="add_to_cars" href="/car-add/960/add'}" id="add_960">Add Car</a>
  12.  
  13. $('#favorite-listings').append(response);
  14.  
  15. $('#favorite-listings').append(response);
  16.  
  17. $('#favorite-listings').append(response);
  18.  
  19. $('#favorite-listings').html(response);
Add Comment
Please, Sign In to add comment