Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8731123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:09:34+00:00 2026-06-13T09:09:34+00:00

So, I am calling a web service from jQuery using the .ajax method. The

  • 0

So, I am calling a web service from jQuery using the .ajax method. The page that is calling the method is an HTTPS/SSL page, yet when the call is made, jQuery keeps making an HTTP request and it is failing because the server is set up to redirect all HTTP traffic to HTTPS…so a 301 error is coming back.

I have inspected my code a million times and tried a million ways to generate the url parameter for the ajax query. (using // for relative and now just appending the protocol https to the beginning of the url. Here is my javascript:

function add_inbound_record(serial_number, pass_fail_value)
{
   pfv = pass_fail_value.toUpperCase();
   url = location.protocol + "//" + location.hostname + "/inbound/record-                 inspection/" + serial_number + "/" + pfv;
   $.ajax({
   url:url,
   cache:false,
   });
}

So, when this code executes, I check the url paramter in firebug and it shows up correctly with https and the URL properly formed. However, when I execute the ajax function I see this in firebug:

301 MOVED PERMANENTLY

192.168.1.9

20 B

192.168.1.9:443

Response Headersview source
Connection  keep-alive
Content-Encoding    gzip
Content-Length  20
Content-Type    text/html; charset=utf-8
Date    Wed, 24 Oct 2012 17:33:34 GMT
Location    http://192.168.1.9/inbound/record-inspection/011234567890123421000000002995/P/?_=1351100020609
Server  nginx/1.1.19
Vary    Accept-Encoding

Request Headersview source
Accept  */*
Accept-Encoding gzip, deflate
Accept-Language en-us,en;q=0.5
Connection  keep-alive
Cookie  djdt=hide; csrftoken=sF9RUxrlS6IKURxOryH2d2yT05gMighn;         sessionid=9682390da4011e445931643c81be9aae
Host    192.168.1.9
Referer https://192.168.1.9/fingerprint/inspect/
User-Agent  Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101     Firefox/15.0.1
X-Requested-With    XMLHttpRequest

As you can see above from the referrer, the protocol is HTTPS yet the location in the response header is HTTP? I can’t for the life of me figure out why the request is going across the wire as HTTP and not HTTPS. The 301 response is accurate considering it is going as HTTP since, again, the webserver is configured to only allow HTTPS access. Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T09:09:36+00:00Added an answer on June 13, 2026 at 9:09 am

    Ok. I messed with this for over 4 hours and as soon as I added a slash to the end of the URL, the issue went away and everything works fine. I have no idea why. The web server/web service does not require a slash to function correctly but for whatever reason, that’s what "fixed" it. Thanks for the helpful comments guys.

    Example note the double slash

    Before:
    https://somedomain.com//requests/get-requests.html?lang=ar

    After (fixed):
    https://somedomain.com/requests/get-requests.html?lang=ar

    UPDATE:
    Issue came back to me meaning after it became working
    when i removed the slash!

    Then this answer saved my day too
    https://stackoverflow.com/a/71382206/944593

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am calling a Page Method from JQuery as described here: http://encosia.com/2008/05/29/using-jquery-to-directly-call-aspnet-ajax-page-methods/ This is
I've got a web service (ASP.NET 2.0) that I'm calling from javascript using jQuery's
I am calling my cross domain web-service through a getJson() call from jQuery. As
I'm calling a method on a web service from behind a proxy server using
I am calling a WSDL web service from Python using SOAPpy . The call
I'm trying to retrieve product information from magento by calling its web service using
I am not able to call web service(asmx) from jQuery function. It is saying
I am using jQuery to call web service (*.asmx) methods. The web service uses
I am experimenting with calling a web-service using jQuery. For some reason the result
I'm trying to test web service calls using an ASP.NET page that creates a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.