aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes how to iterate response object in a table Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "how to iterate response object in a table" Watch "how to iterate response object in a table" New topic
Author

how to iterate response object in a table

Abdul Wahab
Ranch Hand

Joined: Dec 09, 2011
Posts: 49

hi ranchers,
I am submitting a form via Jquery Ajax post method and i get a response object(list of rows from database) successfully.
i dont know how to set the response values in a table.

Any help..


As long as breath left in my body there is hope
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60077
    
  65

What's be easiest is to have the server, perhaps using a JSP, format the table rows to send as the response. Then the HTML fragment can simply be injected into the DOM.

If not that, then what are you getting back as the response? JSON data? if so, you'll need to create all the DOM elements yourself using jQuery's DOM creation capabilities.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Abdul Wahab
Ranch Hand

Joined: Dec 09, 2011
Posts: 49

If not that, then what are you getting back as the response? JSON data? if so, you'll need to create all the DOM elements yourself using jQuery's DOM creation capabilities.

hmm.. not json..i am trying to convert to json..below is my code.. can you help me with that..
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60077
    
  65

What is the response returning?
Abdul Wahab
Ranch Hand

Joined: Dec 09, 2011
Posts: 49

An error occurred! SyntaxError: JSON.parse: unexpected character.. this is the error i am recieving..where am i wrong???
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60077
    
  65

Bear Bibeault wrote:What is the response returning?
Abdul Wahab
Ranch Hand

Joined: Dec 09, 2011
Posts: 49

Actually bear when try without json (normal object) i am getting sucessfull result
out put

but when i try to convert to json i am getting the following error



Abdul Wahab
Ranch Hand

Joined: Dec 09, 2011
Posts: 49

And what is the main difference between attributes in servlet (set or getAttribute) and json. both are object right??
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60077
    
  65

Abdul Wahab wrote:Actually bear when try without json (normal object) i am getting sucessfull result
out put

That's not valid JSON. So of course, it cannot be converted. You'll need to fix the server code to return valid JSON. There are many Java JSON libraries to choose from.
Abdul Wahab
Ranch Hand

Joined: Dec 09, 2011
Posts: 49

That's not valid JSON. So of course, it cannot be converted. You'll need to fix the server code to return valid JSON

yes! you are right
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to iterate response object in a table
 
Similar Threads
Form within a form in Html
jstl table problem
JSTL number formatting
How do I update table using postJSON
Problem with CRUD operation in struts1.3