ajax - How to assign the value of the variable in JavaScript function into a Mason variable? -
i getting window.location.href
property on click of button on client side in javascript variable. requirement send server. how can javascript variable value in mason code?
one option (which have implemented currently) dynamically create hidden text field value set window.location.href
, , form submit.
how can use ajax here? looking ajax solution, how different form.submit()
.
the whole point of problem javascript variable available js interpreter in browser , not server side script. need somehow variable contents , send server. can done either via form (which @ least reload page) or xhr (main technology behind ajax).
i never did xhr directly, using dojo framework can like:
dojo.xhrpost( { handleas: "json", url: "http://example.com/whatever", content: { "data_url" : window.location.href } });
Comments
Post a Comment