• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to pass arguments of function in ajax Response.

 
SunilK Chauhan
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Friends,

I am facing one Problem using Ajax as, I just called a 'search.jsp' file from 'parent.jsp' using Ajax call and want to getting result from it.

Now, the Problem is, From Search.jsp there is one button includes function is returning having some arguments which are not just accessible to my parent file.

For better understanding i have shown my code of Search.jsp file which includes button shown below:

## Search.jsp Code portion:
=>

out.println("<input type='button' name='open_page' id='Search_Form' value='Click to Open' style='text-align: center' onclick='func_op('<%=classpath.elementAt(i) %>');' >");

out.println("</td>");
out.println("</tr>");



Here, As shown above, The vector Classpath is fetched inside the search.jsp file, but i want to get it's value to parent.jsp file.

But how can i do this. Please help me guys.

Thanks and regards,
Sunil
 
Stephan van Hulst
Bartender
Posts: 6337
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
SunilK Chauhan, Please CarefullyChooseOneForum. I'm moving this to Servlets.
 
Stephan van Hulst
Bartender
Posts: 6337
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't mix markup and code. This JSP looks very messy and fragile. You should perform all the logic in your controller, and then pass all the ready made data to the JSP, which acts only as a template.

As for your problem, you have to understand that the function performed when you click the button runs on the client. Any data that's needed on the server needs to be sent there, using an ajax or page request.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic