0

i am trying to make AJAX Call to ASP.Net Server Side Web service method the problem it dose not give me error or exception

i am trying to execute a peace of code when the user click button i want it ti call my custom service and execute it then return me the result in another control [Grid View ]

the code is :

<script type = "text/javascript">
function myfunction() {
    $.ajax({
        type: "POST",
        url: "My method",
        data: Bind Data,
        dataType: "json",
        success: alert();,

    });
}

</script>

the problem is it dose not work i try the fire bug and it do not call the method

1
  • are you specifying the url correct? and what is Bind Data in data:Bind Data Commented Jul 25, 2011 at 13:42

2 Answers 2

1
$.ajax({
        type: "POST",
        url: "/path/to/webservice",
        data: {data:data}, //not sure what Data Bind is?
        dataType: "json",        
        success:function(data){
            alert("success");
       },
        error:function(jxhr){
           alert(jxhr.responseText);
       }

    });

jquery ajax

also here is a useful link POSTing JSON Data to MVC Controllers

Sign up to request clarification or add additional context in comments.

1 Comment

thank you very much ,you answer was great and i found an article that explain my case exactly :)
0

well the question is not clear if you did not make some thing like that before you need to be more specific in your problem you are trying to make a AJAX Call to ASP.Net Server Side Web service method using j query I have a similier post to the same problem in my blog have a look :

http://eslamsoliman.blogspot.com/2011/07/make-ajax-call-to-aspnet-server-side.html

i think that the problem in your jquery code in the URL part and in the success part ,mark as answered if it helps :)

2 Comments

you article was very useful thanks a lot and i will take by your advice in the future
your welcome .and if you searched on stackover flow you can fin similar question : stackoverflow.com/questions/2059621/… stackoverflow.com/questions/2027960/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.