Tutorial :JQuery AJAX Web Service call on SSL WebServer



Question:

I am making a POST to a webservice that is local to the webserver. Everything works great until I host the site at my SSL enabled webserver. The webservice path is relative, meaning, I am making no reference to the protocol. eg. /webservices/method.asmx

The POST results in a runtime error. Has anyone seen this before?

$.ajax({  type: "POST",  url: theURL+"/"+method,  data: body,  success: function(msg) {  alert("Data Saved: " + msg);    },      error:function(msg){      alert("Broken: " + theURL + "/" + method + msg.responseText);      }  });  


Solution:1

What happens if you specify an absolute url, including the protocol https:// piece... I usually put a javascript variable in my masterpages/template for "baseURL" for the prot://host:port/apppath/ reference... where port is only included if not the default. Haven't, iirc, seen such an issue.


Solution:2

Because this project is done in .NET 2.0.. the web method seems to handle the input data differantly. I was able to get around this by just construction a query sting and passing it rather than a JSON object.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »