javascript - How to get params sent by JQuery.load -
i want send parameters $().load.
i tried this, send:
$('#result').load('form.html', {'doc_id': '12'});
on form.html try read doc_id via function:
function geturlvars() { alert ('drin in geturl'); var vars = [], hash; var hashes = window.location.href.slice(window.location.href.indexof('?') + 1).split('&'); alert ('hashes:' + hashes); (var = 0; < hashes.length; i++) { hash = hashes[i].split('='); vars.push(hash[0]); vars[hash[0]] = hash[1]; } return vars; }
but doesn't work. think reason url not change when using jquery.load() function. function geturlvars trying read out doc_ic url since url not change, fails. how doc_ic in form.html?
best regards daniel
looks form {'doc_id': '12'}
makes post request. can try these variants:
1) $('#result').load('form.html', 'doc_id=12');
2) $('#result').load('form.html?doc_id=12');
Comments
Post a Comment