admin管理员组

文章数量:1243237

I am doing phonegap app, I want to access web service from server, in coding javascript get,post or ajax methods working fine for http url request but it cant work for https url request. Please help me, how to called SOAP or secure web service to parse JSON in phonegap through javascript?

I am doing phonegap app, I want to access web service from server, in coding javascript get,post or ajax methods working fine for http url request but it cant work for https url request. Please help me, how to called SOAP or secure web service to parse JSON in phonegap through javascript?

Share Improve this question edited Mar 7, 2011 at 10:07 Mayur Birari asked Jun 17, 2010 at 15:26 Mayur BirariMayur Birari 5,8358 gold badges35 silver badges61 bronze badges 1
  • for https it returning null but in borwser https url working fine,is there any flag in javascript for authentication token – Mayur Birari Commented Jun 17, 2010 at 15:28
Add a ment  | 

3 Answers 3

Reset to default 9

HTTPS is not another protocol, it is merely HTTP over an SSL/TLS- encrypted connection. Since that encryption works transparent to the user agent, to perform a HTTPS AJAX call on your own domain name, your site must be using HTTPS, otherwise you are not able to selectively choose HTTPS on a page you want to perform an AJAX call on that isn't already using HTTPS.

So basically you can't call 'https://yourdomain./fetch' if the page you're calling the AJAX request from isn't using HTTPS.

If you want to perform an AJAX call to a HTTPS domain hosted somewhere else other than your domain, it is somewhat possible to do so (but only in Firefox 3.5+, Safari, Chrome and I think Opera), there is some interesting information about how to make cross-domain AJAX requests possible here: http://metajack.im/2010/01/19/crossdomain-ajax-for-xmpp-http-binding-made-easy/ - this method is not supported in IE (no surprise there).

It is same as every javascript(ajax) function do for phone-gap, in your case its just an invalid certificate issue as per the https server is concern.

If the original loaded page is not connected via https:// then your Ajax calls will not work over https://.

Also Ajax calls must be on the same domain as the main site, as javascript does not allow cross domain Ajax connections.

Also ensure the server side function requested by the Ajax call is returning something other than null.

本文标签: jqueryHow to make an https request in javascriptStack Overflow