Error jquery s ajax method not sending my session cookie

0 votes
After logging in via $.ajax() to a site, I am trying to send a second $.ajax() request to that site - but when I check the headers sent using FireBug, there is no session cookie being included in the request.

What am I doing wrong?
Aug 25, 2020 in Java-Script by kartik
• 37,530 points
462 views

1 answer to this question.

0 votes

Hello @kartik,

AJAX calls only send Cookies if the url you're calling is on the same domain as your calling script.

This may be a Cross Domain ProblemOperating in the cross - domain scenario. During login remote server is returning Set-Cookie header along with Access-Control-Allow-Credentials set to true.

The next ajax call to remote server should use this cookie.CORS's Access-Control-Allow-Credentials is there to allow cross-domain logging.

Hope it helps!!
Thank you!!

answered Aug 25, 2020 by Niroj
• 82,780 points

Related Questions In Java-Script

+1 vote
1 answer

Error:SQL “between” not inclusive

Hello, It is inclusive. You are comparing datetimes to dates. ...READ MORE

answered May 28, 2020 in Java-Script by Niroj
• 82,780 points
128 views
0 votes
1 answer

Error:Invariant Violation: _registerComponent(…): Target container is not a DOM element

Hii @kartik, Basically what you done is right, ...READ MORE

answered Jun 8, 2020 in Java-Script by Niroj
• 82,780 points
1,349 views
0 votes
1 answer

Error:Origin is not allowed by Access-Control-Allow-Origin

Hello @kartik, The easiest way to handle this ...READ MORE

answered Jun 17, 2020 in Java-Script by Niroj
• 82,780 points
534 views
+1 vote
1 answer

How to make anchor tag with routing using Laravel?

Hey @kartik, First you have to go to ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,780 points
8,552 views
0 votes
1 answer

What is redirection in Laravel?

Named route is used to give specific ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,780 points
951 views
0 votes
1 answer

How to install Laravel via composer?

Hello, This is simple you just need to ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,780 points
776 views
+1 vote
1 answer

What are named routes in Laravel and How can specify route names for controller actions?

Hey @kartik, Named routing is another amazing feature of ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,780 points
9,315 views
0 votes
1 answer

How to trigger jquery.ajax() error callback based on server response, not HTTP 500?

Hello @kartik, The error callback will be executed ...READ MORE

answered Jun 18, 2020 in Java-Script by Niroj
• 82,780 points
6,402 views
0 votes
1 answer

jQuery AJAX fires error callback on window unload - how do I filter out unload and only catch real errors?

Hello, In the error callback or $.ajax you have three ...READ MORE

answered Apr 27, 2020 in Java-Script by Niroj
• 82,780 points
1,048 views