Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

AJAX CAll Snding JSON Data

$
0
0

Hi all, I don't know where I went wrong but my AJax call is not working. Below is my code:

$.ajax({
                    type: "POST",
                    url: 'http://localhost:12345/MyWebService.asmx/MyMethod',
                    data: JSON.stringify({textToReplace: variable1,  replacementText: variable2,  pageTitle:variable3}),
                    contentType: "Application/json; charset=utf-8",
                    dataType: "json",
                    success: function (response, status) {                       
                        alert(response.d);
                    },
                    error: function (response, status) {
                        alert('Failure!');
                    },
                });

 I have also tried to pass JSON data like below:

 data: "{textToReplace:" + variable1 + ",replacementText:" + variable2 + ",pageTitle:" + variable3 + "}",

Needless to say it too did not work. When viewed in Firebug the error message goes away too fast.

Please point out where my mistake is if you can spot it. Thanks in advance.


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>