I am new to jQuery and I have the following problem.
My project has say 2 pages, 1.JSP and 2.html. Now I want to pick selected data from 2.html and use it on 1.JSP. Now this was achieved very easily using .load
but I want the data to be present in a JavaScript variable rather than put it on the page (div tags, etc.), so that I can work upon that data (modify or add to database).
I tried using .ajax
and was able to write the following code:
var value = (function () {
var val = nulll;
var filename = " 2.html";
$.ajax ({
'async': false,
'global': false,
'url': filename,
'success' : function(data) {
val = data;
}
})
return val;
})()
document.write(value)
Where do I put the selector format (say div.id5) so that my variable have only relevant data rather than the full file data?