Quantcast
Channel: [Q&A - FAQ Neotys] Last questions
Viewing all articles
Browse latest Browse all 2283

How to test AJAX which needs the session authenticated?

$
0
0

We have a web application implemented with Spring Framework. An scenario is:
1. a user logs in,
2. she fills out a form, then click on a button to create an order. The click will fire an AJAX like this:
http://SERVER/createOrder

The AJAX response contains the order's ID (ORDER_ID).

3. Then the page is populated with another form for more details about the order. When the user fill the new form, she click on a save button, which is another AJAX call to server like:
http://SERVER/saveOrder/ORDER_ID

My questions are:
1. when I run the validation, http://SERVER/createOrder AJAX call is redirected to login page, it seems it is not authenticated. How can I make sure this AJAX uses the session's authentication?

2. Let's assume I could pass step one with your help, how can I get the ORDER_ID from the AJAX response and use it for the second AJAX call (http://SERVER/saveOrder/ORDER_ID)? The first AJAX call returns a JSON like
{"id":"12345"}

Thank you!


Viewing all articles
Browse latest Browse all 2283

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>