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

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -