I have a query on session storage how to store three fields value in a single session storage. I have three fields two radio button (in different groups) and one drop down in the first page this is how my first will look like. I was not able to get multiple field.

For example if user select pg from first radio group,aa from the second radio group and DIP EDU from the drop down third field where i need to store these values as a single session-storage from first page and i need to get the value from the first page and in the second page based on this value i need to show the div. I don't no how store multiple field value in one session storage still i tried a bit from OS users idea. But I am not getting the result :(

<div class="edu"> <input type="radio" id="ug" name="edu" class="ug" value="ug" checked="checked"> <label class="radio-label">Undergraduate</label> <input type="radio" id="pg" name="edu" value="pg" class="pg"> <label class="radio-label">Postgraduate</label> <input type="radio" id="cu" name="edu" value="cu" class="cu"> <label class="radio-label">Continuing Education</label> </div>

And My second div consist of another set of radio button

 <div class="rad_cam"> <input id="ad" class="ad" type="radio" name="cam" value="ad" checked> <label class="radio-label">AD</label> <input id="AA" class="AA" type="radio" name="cam" value="AA"> <label class="radio-label">AA</label> </div> <select class="mslt_Field slt_mjrpg ipt_required" id="slt_mjrpg" name="slt_mjrpg"> <option value="">Please Select</option> <option value="Dip - Prof. PG Dip in Teaching ">DIP EDU</option> <option value="Master of Science in Finance ">MASF</option> <option value="MBA">MBA 2013</option> </select>

In my second page I have simple div where i need to show a label.

<div>Second page</div>
With my current jQuery code in the first page

function storedata(){
alert("check");
var storeDate = {},key,val;
key = $('#pg,#alain').attr('id');
val = $('#pg,#alain').is(':checked');
storeDate[key] = val;   
sessionStorage.setItem('storeDate', JSON.stringify(storeDate));
console.log(key);
}  

and I am calling the function in next button .this is my second page jquery code

var otherObj = JSON.parse(session.getItem('storeDate'));
    if(otherObj.ug && otherObj.alain){
        alert("check");
    }

But I am getting ReferenceError: session is not defined kindly please let me know what i am doing wrong here

whether my storing json data in jquery is that wrong or ...... :(
Thanks in advance

Recommended Answers

All 2 Replies

Is your variable sessionStorage or session? You set item to sessionStorage but then try to get item from session variable...

it was session storage

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.