Thursday, 15 January 2015

java - After ajax call redirect the response to another jsp -



java - After ajax call redirect the response to another jsp -

i have ajax phone call jsp page sends request modelandview class in controller.

ajax phone call in test.jsp

function currentposition(l1, l2) { var url="home/test"; var data= 'lat1=' + l1 + '&lat2=' + l2; $.ajax({ type:"post", url:url, data:data, datatype:"json", success:function(responsejson){ alert(responsejson); } }); }

controller

public modelandview gettest(@context httpservletrequest request) { modelandview responseview = new modelandview(new jsonview()); //some code here if (somecondition) { response.addobject("jsondata", vehicleid); } else { system.out.println("not present"); } homecoming responseview; }

i getting response controller test.jsp , getting desired results. want redirect results another.jsp result should appear in drop downwards list follows.

another.jsp

<select class="test" id="vehicle-id"> <option>...</option> </select>

how do this?

try these adding in success response of ajax call:

var surl = '<%=request.getcontextpath()%>/registration'; window.location.replace(surl);

java javascript jquery ajax jsp

No comments:

Post a Comment