| Author |
how to iterate response object in a table
|
Abdul Wahab
Ranch Hand
Joined: Dec 09, 2011
Posts: 48
|
|
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: 56157
|
|
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.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Abdul Wahab
Ranch Hand
Joined: Dec 09, 2011
Posts: 48
|
|
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: 56157
|
|
|
What is the response returning?
|
 |
Abdul Wahab
Ranch Hand
Joined: Dec 09, 2011
Posts: 48
|
|
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: 56157
|
|
Bear Bibeault wrote:What is the response returning?
|
 |
Abdul Wahab
Ranch Hand
Joined: Dec 09, 2011
Posts: 48
|
|
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: 48
|
|
|
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: 56157
|
|
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: 48
|
|
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
|
 |
 |
|
|
subject: how to iterate response object in a table
|
|
|