2

I need to retrieve the parameter passed in answer to a AJAX request.

Using this code:

$.ajax({
    url: 'https://example.com/login/',
    data: { username: User, password: Pass },
    type: 'get',
    success: function (output) {
        ...
    }
});

The page return some parameters i.e. https://example.com/login/?res=success&...

How can I get those parameter instead of the page content in "output"?

I add some information.

We use an external hotspot service provider in order to provide wifi access to our customers. The service is hosted on a website i.e. www.example.com We need to provide our customers the ability to enter their credentials from our website. The above code is in our website and the ajax request is directed to the login page of the hotspot service provider. When I send the request, the page return the parameter ?res=success. I need to get this parameter after my ajax request.

11
  • what do you want to retrieve? Commented Jul 31, 2017 at 2:50
  • I need to retrieve the parameter res=success from the page in answer to my ajax request - example.com/login/?res=success&... Commented Jul 31, 2017 at 2:53
  • You want to retrieve this parameter from current URL? Commented Jul 31, 2017 at 3:00
  • @Nitesh When I use the browser and enter the URL with parameters ?username=user&password=pass the page is opened and URL change with parameter ?res=success . I need to retrieve this parameter after my ajax request Commented Jul 31, 2017 at 3:08
  • 1
    can you provide an screenshot of the http response headers of your ajax request (in the dev tool console for example). if you find that url containing the parameter you wanna retrieve in one of the header, you could use the getResponseHeader() to get it as in this Stack overflow answer: stackoverflow.com/questions/11440918/… Commented Jul 31, 2017 at 4:09

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.