Sorry if this is a stupid question.
But say I have an AJAX request that is to return this :
format.js { render :partial => 'quickbooks/job', :locals => {:job => @jobs_to_sync }, :layout => false }
And @jobs_to_sync is an array of many jobs. So instead of building all these jobs with some fancy javascript, can I return the entire array built for me with the partials I already have?
This would be the exact same way if I had one object, where Rails would return your object implemented in the partial. But alternatively, I would like Rails to return via JSON, all my objects, each implemented with the same partial.
In this way, in my original AJAX call, I can just append the success(data) return.
You can create a new object and using map ou hash create a bigger object with all the others objects.
like
@MyObject = new Object;
@MyObject.json1 = json1
@MyObject.json2 = json2
.
.
.