Call load using a div id that has been passed into a function, div id is a parameter

Posted by tittatty on Stack Overflow See other posts from Stack Overflow or by tittatty
Published on 2010-04-19T15:52:49Z Indexed on 2010/04/19 16:03 UTC
Read the original article Hit count: 188

Filed under:
|
|
|
|

I am dynamically creating divs within a jquery accordion that are loaded with data as when the user clicks on the accordion title. I have this all working except that when I pass the div id into the load details method, the call to .load() does not work. What can I do to fix this? It seems like a simple javascript string eval would work but I can not find what I am looking for.

Code: Here is the basic function:

function loadDetails(div_id) {
   var load_string = "ajax/get_details.aspx";
   $(div_id).load(load_string);
 }

This function is called correctly on the click event and the div_id is passed in correctly but the load function is not working. If I use code like this it work correctly:

$('#test').load(load_string);

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery