Hi,
Good Afternoon,
I want to pass data from my html page to Aspx page and this HTML page is rendered into Aspx page at run time by using <!--#INCLUDE FILE="..\HTML\GroupRegistration.html"--> in aspx source.
In JavaScript file my method is
$(document).ready(function ()
{
$("#btnSave").click(function () {
var GroupName = document.getElementById('txtGrpName').value;
var GroupType = document.getElementById('ddlGrpType').selectedIndex;
var GroupAddress = document.getElementById('txtAddress').value;
var FirstName = document.getElementById('txtFirstName').value;
try {
$.ajax({
type: "POST",
url: "GroupRegistration.aspx",
data: {
"param1=": +GroupName, "param2=": +GroupType, "param3=": +GroupAddress, "param4=": +FirstName, },
contentType: "application/x-www-form-urlencoded; charset=utf-8",
dataType: "html",
success: function (msg) {
},
error: function (xhr, status, error) {
alert('Error');
}
});
}
catch (e) {
alert(e);
}
});
});
and I am getting the values in aspx.cs file like below.
string txtGrpName = Request.Form["param1"];
int ddlGrpType = Convert.ToInt32(Request.Form["param2"]);
string txtAddress = Request.Form["param3"];
string txtFirstName = Request.Form["param4"];
and then in javascript file I am getting exception "$ is undefined"
So please give solution to my problem?
And explain the procedure to pass data.
Thanks in advance