Click here to Skip to main content
15,074,181 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My application developed in mvc 3 + razor , I have two page add detail and edit detail , and a button named Estimation on both page , When i click on the button i open a model jquery popup of Estimation form.
Estimation page having a dropdown of year's when i select year i populate all rates by following script.

JavaScript
<script type ="text/javascript">

    $(function () {
        $('#RatePeriodid').change(function () {
            var selectedValue = $(this).val();
            $.ajax({
                type: "POST",
                url: '../WebServices/AddSOP.asmx/PopulateEstimationRates',
                data: "{Period_id:'" + selectedValue + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                async: false,
                success: function (msg) {
                   
                    var data = msg.d;
                    $('#Standerd_Weekday_Rate').val(data.Standerd_Weekday_Rate);
                     .................................
		     and so on 
                   
                },
                error: function (msg) {
                    alert("Error");


                }
            });

        });
    });
     
</script> 


My problem is when i open popup from add detail page all things are working fine , but when i open popup from edit detail page , and select an year from dropdown my ajex script giving error message. And my web service (../WebServices/AddSOP.asmx/PopulateEstimationRates) not calling .
What is the wrong with my code ?
Posted
Updated 9-Aug-12 22:44pm
v2

1 solution

The ".." at the beginning of the url is not a good idea. Use rather absolute path relative to site root: "/full/path/to/AddSOP.asmx". And just to be sure use IE Developer tools or Fiddler to see if the correct url is called and the call data is populated as you want.
   
v2
Comments
Manoj Kumar Choubey 10-Aug-12 4:59am
   
Yes My Problem is solved ......
Manoj Kumar Choubey 10-Aug-12 5:02am
   
Thank you ....
Zoltán Zörgő 10-Aug-12 5:08am
   
You are welcome...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900