I am using this Ajax code. But I dont know how i will retrieve my value of value1 on my server-side asp using Javascript.
On my serverside I want to have something
//(javascript, ajax = xmlHttp)
if your response text is an array you can use this.
var myArray = eval(xmlHttp.responseText);
or if it is a just text you can use .
var value = xmlHttp.responseText
Another approach.This is just a template. If you use jquery, you can use this approach. i hope it solve your problem or give an idea.
html part:
JQuery part:
$(document).ready(function() {
getValue("serverurl",updateName)
getValue("serverurl",updateSurName)
});
function updateName(name){
$("#willupdate").text(name)
}
function updateSurName(name){
$("#willupdate2").text(name)
}
function updateSurName(name){
$("#willupdate").text(name)
}
function getValue(url,opt_onRecieved){
if( !url || url == ""){
alert("request url error");
return;
}
$.ajax({
type:"POST",
url: url,
dataType:"json",
success: function(data){
opt_onRecieved(data);
}
});
}