TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Vikas Singh
1.3k
410
14.9k
I am unable to call ajax method
Jan 31 2021 5:14 PM
Hello when i am calling this function showing error in---
$.ajax({
<form id=
"form1"
runat=
"server"
>
<h3>Register Vendor</h3>
<div
class
=
"form-group"
>
<asp:TextBox runat=
"server"
ID=
"txtfirstname"
MaxLength=
"20"
type=
"text"
placeholder=
"First Name"
class
=
"form-control"
onkeyDown=
"checkTextAreaMaxLength(this,event,'20');"
/>
<asp:TextBox runat=
"server"
ID=
"txtlastname"
MaxLength=
"30"
type=
"text"
placeholder=
"Last Name"
class
=
"form-control"
onkeyDown=
"checkTextAreaMaxLength(this,event,'30');"
/>
<%--<asp:RequiredFieldValidator runat=
"server"
ControlToValidate=
"txtfirstname"
Display=
"None"
ValidationGroup=
"vendorSignup"
ErrorMessage=
"First Name is required !"
></asp:RequiredFieldValidator>
<asp:RequiredFieldValidator runat=
"server"
ControlToValidate=
"txtlastname"
Display=
"None"
ValidationGroup=
"vendorSignup"
ErrorMessage=
"Last Name is required !"
></asp:RequiredFieldValidator>--%>
</div>
<div
class
=
"form-wrapper"
>
<asp:TextBox runat=
"server"
ID=
"txtusername"
MaxLength=
"35"
type=
"text"
placeholder=
"Username"
class
=
"form-control"
onkeyDown=
"checkTextAreaMaxLength(this,event,'35');"
/>
<%--<asp:RequiredFieldValidator runat=
"server"
ControlToValidate=
"txtusername"
Display=
"None"
ValidationGroup=
"vendorSignup"
ErrorMessage=
"Username is required !"
></asp:RequiredFieldValidator>--%>
<i
class
=
"zmdi zmdi-account"
></i>
</div>
<div
class
=
"form-wrapper"
>
<asp:TextBox runat=
"server"
ID=
"txtemail"
MaxLength=
"40"
type=
"emil"
placeholder=
"Email ID"
class
=
"form-control"
onkeyDown=
"checkTextAreaMaxLength(this,event,'40');"
/>
<%--<asp:RequiredFieldValidator runat=
"server"
ControlToValidate=
"txtemail"
Display=
"None"
ValidationGroup=
"vendorSignup"
ErrorMessage=
"Email ID is required !"
></asp:RequiredFieldValidator>--%>
<i
class
=
"zmdi zmdi-email"
></i>
</div>
<div
class
=
"form-wrapper"
>
<asp:TextBox runat=
"server"
ID=
"txtmobile"
MaxLength=
"10"
type=
"number"
placeholder=
"Mobile Number"
class
=
"form-control"
onkeyDown=
"checkTextAreaMaxLength(this,event,'10');"
/>
<%--<asp:RequiredFieldValidator runat=
"server"
ControlToValidate=
"txtmobile"
Display=
"None"
ValidationGroup=
"vendorSignup"
ErrorMessage=
"Mobile Number is required !"
></asp:RequiredFieldValidator>--%>
<i
class
=
"zmdi zmdi-phone"
></i>
<%--<i
class
=
"zmdi zmdi-caret-down"
style=
"font-size: 17px"
></i>--%>
</div>
<div
class
=
"form-wrapper"
>
<asp:TextBox runat=
"server"
ID=
"txtpassword"
MaxLength=
"20"
type=
"password"
placeholder=
"Password"
class
=
"form-control"
onkeyDown=
"checkTextAreaMaxLength(this,event,'20');"
/>
<%--<asp:RequiredFieldValidator runat=
"server"
ControlToValidate=
"txtpassword"
Display=
"None"
ValidationGroup=
"vendorSignup"
ErrorMessage=
"Password is required !"
></asp:RequiredFieldValidator>--%>
<i
class
=
"zmdi zmdi-lock"
></i>
</div>
<div
class
=
"form-wrapper"
>
<asp:TextBox runat=
"server"
ID=
"txtconfirmpassword"
MaxLength=
"20"
type=
"password"
placeholder=
"Confirm Password"
class
=
"form-control"
onkeyDown=
"checkTextAreaMaxLength(this,event,'20');"
/>
<%--<asp:RequiredFieldValidator runat=
"server"
ControlToValidate=
"txtconfirmpassword"
Display=
"None"
ValidationGroup=
"vendorSignup"
ErrorMessage=
"Confirm Password is required !"
></asp:RequiredFieldValidator>--%>
<i
class
=
"zmdi zmdi-lock"
></i>
</div>
<button id=
"btnsubmit"
onclick=
"VendoRegistrationvalidation();"
>
Register
<i
class
=
"zmdi zmdi-arrow-right"
></i>
</button>
</form>
<script>
function
VendoRegistrationvalidation() {
if
(document.getElementById(
'txtfirstname'
).value ==
""
) {
alert(
'First Name is required !'
);
return
false
;
}
if
(document.getElementById(
'txtlastname'
).value ==
""
) {
alert(
'Last Name is required !'
);
return
false
;
}
if
(document.getElementById(
'txtusername'
).value ==
""
) {
alert(
'User Name is required !'
);
return
false
;
}
if
(document.getElementById(
'txtemail'
).value ==
""
) {
alert(
'Email is required !'
);
return
false
;
}
if
(document.getElementById(
'txtmobile'
).value ==
""
) {
alert(
'Mobile Number is required !'
);
return
false
;
}
if
(document.getElementById(
'txtpassword'
).value ==
""
) {
alert(
'Password is required !'
);
return
false
;
}
if
(document.getElementById(
'txtconfirmpassword'
).value ==
""
) {
alert(
'Confirm Password is required !'
);
return
false
;
}
if
(document.getElementById(
'txtpassword'
).value != document.getElementById(
'txtconfirmpassword'
).value) {
alert(
'Please make sure your password match !'
);
return
false
;
}
var
model = {
FirstName: document.getElementById(
'txtfirstname'
).value,
LastName: document.getElementById(
'txtlastname'
).value,
Email: document.getElementById(
'txtemail'
).value,
mobile: document.getElementById(
'txtmobile'
).value,
LoginID: document.getElementById(
'txtusername'
).value,
Password: document.getElementById(
'txtpassword'
).value
}
$.ajax({
type:
'POST'
,
contentType:
'application/json; charset=utf-8'
,
data: JSON.stringify(model),
dataType:
'json'
,
cache:
false
,
async:
true
,
url:
'/RegisterVendor.aspx/SignupVendor'
,
//Call server side code
success:
function
(result) {
var
vm = JSON.parse(result);
if
(vm.IsExists !=
"0"
) {
if
(vm.IsExists ===
"1"
) {
location.href =
'/Home'
;
// on Successfull vaildation
}
else
{
$(
'#dis'
).slideDown().html(
'<span id="errorLogin">Invalid UserID or Password! or InActive Login</span>'
);
}
}
else
{
$(
'#dis'
).slideDown().html(
'<span id="errorLogin">Invalid UserID or Password!or InActive Login</span>'
);
}
},
error:
function
(xhr, ajaxOptions, thrownError) {
},
});
}
</script>
Reply
Answers (
3
)
Textarea does not support hyperlink in asp.net core
JWT Authentication in Razor Pages .net core