1.How to Give the url of JavaScript ajax call????
2.Any tutorial which teach me step by step how to call JavaScript ajax call in asp.net??????
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Anubhav ChaudharyPosted Jun 23, 2015, 12:54 AM
- jQuery.ajax({
- type: 'POST',
- contentType: "application/json; charset=utf-8",
- url: 'WebService1.asmx/getCityData',
- data: "{'stateName':'" + stateName + "'}",
- dataType: 'JSON',
- success: function (response) {
- StateCityChart(response);
- return false;
- },
- error: function (er, sw, sq) {
- //alert("Error occured in application");
- }
- });
1- In url you need to pass your "pagepath /methodname".Saroj Kumar SahuPosted Jun 23, 2015, 1:47 AM
Shuvojit HalderPosted Jun 23, 2015, 12:47 AM
var xmlhttp;
if (str=="")
{
document.getElementById("txtHint").innerHTML="";
return;
}
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","getcustomer.aspx?q="+str,true);
xmlhttp.send();
}