Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8108007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:57:32+00:00 2026-06-06T00:57:32+00:00

jquery looks like this $.post(‘JSP/processForm.jsp’, $(#Form).serialize(), function(data){ //I want to iterate through every line

  • 0

jquery looks like this

    $.post('JSP/processForm.jsp', $("#Form").serialize(),
          function(data){
          //I want to iterate through every line in the data object returned here.

   });

I searched and tried:

$.each($(data), function(key, value) {
      alert(value);
});

But that did not work. I understand the response needs to be encoded into a jQuery object first.

$(data)

But i just can’t seem to find a way to iterate through every line. The jsp code is simply:

out.println("Test");
out.println("Test Email");
out.println("Test CellPhone");
out.println("305-777-5587");
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T00:57:36+00:00Added an answer on June 6, 2026 at 12:57 am

    A few things to note:

    • Your jsp is likely being rendered and returned with a header that suggests it’s html content. You are (somewhat arbitrarily) deciding that each new line of text represents a new piece of data.
    • jQuery each documentation shows it only works on a collection, so jQuery wrapping your object isn’t necessary. (http://api.jquery.com/jQuery.each/) However, jQuery has no method by which to parse your returned html into a javascript collection object.
    • If you are truly trying to end up with a javascript structured data object, you may consider sending your output as JSON (javascript object notation). From what I’ve seen, it seems more fitting in this case.

    If you did want to continue this way, you’d need to write some javascript to split your response html at the new line. It would likely look like this (you may need to play around with it)

    var myData = data.split(/\r\n|\r|\n/);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form that looks something like this: <form id=uploadForm name=uploadForm method=post enctype=multipart/form-data>
my post looks like this: $.post('/ajaxvalidate/1', {nid: nid}, function(data) { I get the Uncaught
I've built a jQuery selector for a function which looks like this: $('html').not('.table-main tr[selected]').mousedown(
I have a problem with a jquery function. My HTML looks like this, I
My HTML looks like this: <script type=text/javascript src=jquery-1.4.2.js></script> <script type=text/javascript> $(document).ready(function(){ $(#btn).click(function(){ $.post(test.jsp, {
Here's an interesting problem: I have some jQuery that looks like this: $(document).ready(function() {
I have my own edit in place function for jquery which looks like this
I have a form that looks like this: <form name=armdisarmform action=/cameras method=POST> <input type='hidden'
I have some jQuery that looks like this: $.ajax({ type: POST, url: /Customer/CancelSubscription/<%= Model.Customer.Id
I have some jQuery that looks like this: $.ajax({ type: POST, url: /problems/vote.php, dataType:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.