2

I have a problem regarding modal popup and session.

I have two component name test and test1 respectively.

  • In test there is a form in view in which i put "Anchor" tag with "modal" class. has also class name "class1".

When i clicked on Anchor tag it call click function(on click "class1") in which i put ajax code for set data using "Session".

$('.test').click(function(){

// Ajax code here for set data using session

});

with above function it also called modal popup. here targer url is seted which is the view of 2nd component which is "test1".

Here in test1 there is a view.html , we are getting session data here and displaying in view.

PROBLEM

  • Problem is that , here in 2nd component , in view i am getting session data but i need to click on button two time , only after i getting data properly.

When i click on it give me a old session data. and when i click on it second time it will give me a proper data.

What is the solution for above problem. if anyone know please let me know.

Manish Patel
  • 89
  • 2
  • 6

2 Answers2

2

Session data is altered only after we click on Anchor tag.

  • Both thing is done on Anchor click , one is for set data in session and second is for modal popup. in popup i am getting data which set in session.
Manish Patel
  • 89
  • 2
  • 6
1

when is the session data is being altered? Is it altered by ajax call too?

In this case, javascript, is unsynchronous. It doesn't wait for something to happen in order to fire the next line of code. In that case there are several techniques you may find to do so.

pcrikos
  • 87
  • 5