asp.net - JQUERY AJAX POST to WCF Service -


I am trying to get data from a web service using the POST method.

To get this data, my JavaScript

  var s = {OpportunityID: 6} $ .ajax ({type: "post", url: "/ ws / WSServices .svc / GetStudentTimeTableByOpportunityID ", data: JSON.stringify (s), contentType:" application / json ", data type:" JSON ", async: false, success: function (data) {console.log (data);}} );  

This is my server side code

  [code of operation] [webinvok (method = "post", response format = webmail format.jason, request format = webmail format Jason)] Public List & lt; DataEntity.CalendarEvent & gt; GetStudentTimeTableByOpportunityID (Intel OpportunitiesAITIS) {Utils.Debug ("InWebService:" + OpportunityID); & Lt; DataEntity.CalendarEvent & gt; Events = New list & lt; DataEntity.CalendarEvent & gt; (); // populated event code returns event; }  

The problem is that it is not even running the first line of code and it is always showing that there is a poor request (400). Please see screenshots in FireBug

Enter image details here

I checked it and it shows the correct data in JSON format and I could not understand why 400 error is showing.

Please help me highlight that how can I get a post request for WCF Webservices using JQUERY AJAX.


Comments