tags:

views:

31

answers:

1

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?

A: 

When you moved the build, did you make sure that:

  1. VS2008 has been updated to SP1
  2. ASP.NET MVC has been installed.
  3. .NET Framework has been installed and updated to 3.5 SP1.

Is the url rendered correctly? Are you just putting the validation code into a JS file, or is it in a view. If it's the former, then you'll need to move it, because you won't be able to render the Url.Action on line 4.

Dan Atkinson