I have a MVC app that works fine before. but it did not work any more with no change. Pretty confused.
My view has follwing hyperlink for data input validation:
<span><a href="#" id="validate">Verify Input</a> </span>
the validation code is:
<script type="text/javascript">
$(function(){
$("#validate").click(function(){
alert("Test 1");
$.post("<%=Url.Action("SaveComment","MyVerify") %>", GetPageData(),ProcessResponse);
alert("Test 3");
});
});
function GetPageData() {
return{
FullName: $("#Name").val(),
ID: $("#ID").val()
};
}
function ProcessResponse(data){
alert("Test 2");
if(validating()){
if(data=="true"){
$("#VerifyMessageDiv").html("Your information is correct. ");
//...
}
else{
$("#VerifyMessageDiv").html("Your information is not correct.");
//....
}
}else{
$("#myform").hide();
}
}
//client side validation
function validating() {
//...
alert("testing message");
}
</script>
Logic is: use js validate at client side firstly, then use Controller MyVerify to verify data at server side. It looks like url action call fail. I got "Test 1" and "Test 3", but no "Test 2", no "testing Message".
The code still works on XP with VS2008, but not work on Vista with VS 2008, When I move the build to Windows 2008, also not work.
It worked before. Not sure why. How to fix it?