I have several content items on the page all of the are hidden and they have each a unique ID. #data serves as a temporary stack.
<div id="data"></div>
<div id="item1212">...</div>
<div id="item2323">...</div>
<div id="item3434">...</div>
<div id="item4545">...</div>
an Ajaxrequest gives me back a certain ID
$('#data').load('http://someURL');
fills the #data:
<div id="data">2323</div>
width this lines I make my correspondig item visible:
var theID = $('#data').text().val();
$('#item'+theID).toggleClass('visible');
This was my idea. Guess: Ist does not work cause it fails to read #data and use the value as a string. Its alwas an object (?).
I save the value first in html cause I dont know how to save a ajax-result (its always a string value) to a JS variable.
But I guess you have much better ideas how to solve my Problem: Show item width an certain ID that is receved by ajax