Click here to Skip to main content
15,889,992 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I'm not able to read response of jquery ajax on success full execution of jquery function and on status 200 ok error function is running.
Please help, for reference see below code


<script>
       $(document).ready(function () {
           $('#loadingPanel').hide();
           $('#btnsave').click(function () {

               var Name = $('#txtName').val();
               var Head = $('#txtHead').val();
               var Phone = $('#txtPhone').val();
               var Address = $('#txtAdd').val();
               alert(Name + Phone + Head + Address);
               //alert(data);
               //$('#loadingPanel').show();
               $.ajax({
                   url: "WebService1.asmx/success",
                   type: "POST",
                   dataType: "jsonp",
                   contentType: "application/json; character=utf-8",
                   data: '{"Name": "' + Name + '","Head": "' + Head + '","Phone": "' + Phone + '","Address": "' + Address + '"}',

                   //data: JSON.stringify(Details),
                   success: function (data, status) {
                       alert(data.responseData.results.length + ' results found!');
                   },
                   error: function () {
                       alert('Something goes wrong!');
                   }

               });

           });

       });
   </script>


CSS
Remote Address:[::1]:11679
Request URL:http://localhost:11679/WebService1.asmx/success?callback=jQuery11020997845095815137_1433094227735
Request Method:POST
Status Code:200 OK




Respons is
{"d":"25"}
Posted

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