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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Anubhav ChaudharyRank #29 · 42K reputationPosted Jun 22, 2015, 8:54 PM EDT
- 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".Shuvojit HalderRank #2,827 · 503 reputationPosted Jun 22, 2015, 8:47 PM EDT
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();
}
Saroj Kumar SahuRank #1,766 · 849 reputationPosted Jun 22, 2015, 9:47 PM EDT