Hi I am using this code to pass a data-testid parameter
--- php loop here
echo <<<_END
<pre>
<ul data-role="listview"> <li>
<a id="test" href="#test" data-rel="dialog" data-testid="$row[1]">$row[3] $row[1]</a>
</li> </ul>
</pre>
_END;
And I am using this to retrieve it on the links internal page #test:
var b = $('a#test').data('testid');
document.write(b);
The problem is that although >$row[3] $row[1]< loops correctly and changes the data-testid=”$row[1]” stays the same when retrieved – even when the test number is not even in the database return anymore! It has stayed the same since the first one I called (which was the correct number). How do i get it to refresh?
I have tried no quotes and single quotes around $row[1] but the result is the same.
You may want to include some more code, as in how do you populate the rows array and where do you call the jquery function.
I’ve just tested this code:
And it works like it should, it returns this as output:
So the problem is either in populating the array, or more likely in querying it in jquery. I noticed that you’re using the same id ‘test’ for the link, this is a bad practice. Change the link-id for each link and try again printing the data.