Hello sir, Here is my code for PassAjaxResponseToFunction. Its not executing..
<script src="bootstrap-3.3.6-dist/js/salajax.js"></script>
<script type="text/javascript">
function CheckName(i) {
var name = i.value;
var Path = 'CommonAjax.aspx?CheckName=MyName&NameMethod="' + name + '"';
PassAjaxResponseToFunction(Path, ShowMyResult);
}
function ShowMyResult(args) {
alert(args);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div >
Name : <asp:TextBox ID="txtName" class="form-control" onblur="return CheckName(this);" runat="server"></asp:TextBox>
</div>
Here is the function of return by ajax.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace MyFirstMVCApp
{
public partial class CommonAjax : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Request.QueryString["CheckName"] == "MyName")
{
MyName();
}
}
public void MyName()
{
String Status="";
string Name = Request.QueryString["NameMethod"];
if (Name=="Kailash")
{
Status= "Kailash";
}
else
{
Status="";
}
Response.Clear();
Response.Write(Status);
Response.End();
}
}
Views:
8800
Total Answered:
2
Total Marked As Answer:
1
Posted On:
07-Jan-2016 10:36