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

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);

Answers


$("#" + div_id).load(load_string);

I'm assuming the div_id being passed in is missing the pound?


maby: $('#' + div_id).load(load_string);

http://api.jquery.com/id-selector/


Need Your Help

phonegap build and Facebook Plugin

facebook cordova phonegap-plugins phonegap-build

Maybe it's a stupid question, but I can not solve it!