Click here to Skip to main content
15,891,951 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I can able to get result ,if i called the WCF service only when i run the WCF alone.So WCF service is working fine

This a actual URL to get the Result :
C#
http://localhost:57946/MaterialIssueService.svc/MaterialServiceJson/GetMaterialIssued/2015-01-25/2015-01-29/1/1

these are the parameters
/2015-01-25/2015-01-29/1/1

but when i make a request through AJAX,The HTTP request generating like below.
C#
http://localhost:57946/MaterialIssueService.svc/MaterialServiceJson/GetMaterialIssued?{2015-01-25/2015-01-29/1/1}


So ,I'm not able to get a result ,How do i pass parameter ?

What I have tried:

JavaScript
$(function () {
           $('#btnSubmit').click(function () {
               var params = {
                   'FromDate': "2015-01-01",
                   'ToDate': "2015-01-29",
                   'PageIndex': "1",
                   'PageSize': "1"

               }
               debugger;
               $.ajax({
                   url: "http://localhost:57946/MaterialIssueService.svc/MaterialServiceJson/GetMaterialIssued",
                   type: "Get",
                   data: JSON.stringify(params),
                   dataType: "json",
                  contentType: "application/json; charset=utf-8",
                   success: function (data) {
                       if (data.status == "Success") {
                           alert("Done");

                       } else {
                           alert("Error occurs on the Database level!");
                       }
                   },
                   error: function (ex) {
                       debugger;
                       alert(ex.responseText);

                   }
               });
           });
       });
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