Using .attr() to pass data between page
I have an application where an HTML page is loaded into a jquery-ui dialog. I need to save a value obtained on this inner page using javascript (a string)
I have been saving it as an attribute on an element on the outer page like this:
$('#button').attr("string", 'value');
from javascript on inner page.
And accessing it on the outer pages' JS like this:
$('#button').attr("string");
If I use the inner page multiple times, it becomes "out of phase" with the data sent:
1st time: displays 1st string on inner page, displays 1st string on outer page
2nd time: 2nd string on inner page, 1st string on outer page
3rd time: 3rd string on inner page, 2nd string on outer page
And so on.
It's one string behind each time.