In safari browser , i have developed some validation code through jQuery Ajax. while i was use onsubmit method , the ajax code didn't work properly. so i couldn't take value and not complete the validation process.
pls any one help me for close this issue.
Thanks in advance.
Thanks & Regards,
Naga
Post us some code or some concrete question. Then I'll do my best to help you.
Don't reinvent the wheel.
Tobias
Hi Tobias,
Thanks for quick reply. I was listed some html & script code below of this passage. I think it will be help to you.
HTML:
<! DOCTYPE HTML>
<html>
<head>
<script type="text/javascript" src="Script/HealthLogin.js"></script>\
</head>
<body >
<form id="LoginForm" method="post" onsubmit="submitPage()" enctype="multipart/form-data" action="roleProfile.html">
<td>UserName</td> <td><input type="text" id="txtUser" class="tb8" title="User Name" autofocus></td><td> </td>
<td>Password</td> <td><input type="password" id="txtPassword" class="tb8" title="Password"></td>
<!-- <td><img src="Themes/Images/Go.png" id="lgnClick" class="GoIcon" title="Go" /></td> <td><img src="Themes/Images/voice.png" class="IconImgs" title="Voice" onClick="alert('Page Under Constrution')" /></td> -->
<!-- <td> <input type="submit" value="submit" /> </td> -->
<td id="tdSubBtn"><input type="submit" value="" style="background-image:url(Images/Go.png); no-repeat center top; width:30px; height:30px; border:0px solid red; position:absolute; top:10px;" /></td>
</form>
</body>
</html>
Script Code:
function submitPage()
{
getUserName = $("#txtUser").val();
getPassword = $("#txtPassword").val();
if( getUserName.length > 0 && getPassword.length > 0)
{
$.ajax(
{
type: "POST",
url: "http://www.max360group.com/max360group_demo/HISonMobile.asmx/LoginCheck",
data: "{'Username':'" + getUserName + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(mgs)
{
if(mgs.d != "InValid User!")
{
getTimeIndexValue = mgs.d.indexOf('!');
getTimeValue = mgs.d.substring(0,getTimeIndexValue);
getUserType = mgs.d.substring(getTimeIndexValue+1,getTimeIndexVa lue+2);
sessionStorage.setItem('setSessLastLogin', getTimeValue);
sessionStorage.setItem('setSessUserType', getUserType);
rolePageCall();
}
},
error: function (mgs)
{
alert(mgs.d);
}
});
}
else
{
alert(" Username or Password can not be empty");
}
}
Thanks in Advance.
Regards,
Naga
I see one obvious error. The form is still posted as normal. You have to disable the basic post functionality.
Make sure the submitPage() return false all the time.
I'm not sure about you form-tag:
Maybe you should rewrite it to:Code:<form id="LoginForm" method="post" onsubmit="submitPage()" enctype="multipart/form-data" action="roleProfile.html">
Is the page still reloading?Code:<form id="LoginForm" method="post" onsubmit="javascript: return submitPage();" enctype="multipart/form-data" action="roleProfile.html">
Don't reinvent the wheel.
Tobias
Thank you for the reply.
I will the correct the code. Once again thanks for your help.
Regards,
Naga
Thank you for the posting