# AJAX call and data return through JSON in ROR

**URL:** <https://www.ruby-forum.com/t/ajax-call-and-data-return-through-json-in-ror/117998>\
**Category:** Rails\
**Created:** [October 23, 2007, 10:33am UTC](https://www.ruby-forum.com/t/ajax-call-and-data-return-through-json-in-ror/117998 "2007-10-23T10:33:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rails\_junkie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/45deac/32.png) [@Rails\_junkie](https://www.ruby-forum.com/u/Rails_junkie)\
**Post date:** [October 23, 2007, 10:33am UTC](https://www.ruby-forum.com/t/ajax-call-and-data-return-through-json-in-ror/117998/1 "2007-10-23T10:33:26Z")

</div>

Hello all,

This could be a tootally boonie question. i am trying to do this very  
simple app.  
I have a simple form where user enters data,once entered, i add that  
data in a div ‘data’ . which works fine but i want to save that data  
perodically(all the data in DIV ‘data’) or if user hits a save button  
with each data row.

Now one thing i am not sure about that when user hits button 'save  
data; for a row,i execute the following

new Ajax.Request(’/saveData’, {method: ‘post’,asynchronous:true,  
evalScripts:true,onSuccess:DoASNeeded()});

which saves the data but i am not sure how to retrieve the primarky  
key of saved record and update it async. to that row. i am not sure  
how to retrieve PK of saved record and use it later for any  
modifications.

please help
