I am using plupload to perform multipart file uploads. On success, it returns the serverdata that was stored. But i am receiving a string instead of an object containing all my attributes.
This is my controller action:
def upload
@user = User.create! :name => params[:photo_name], :swf_uploaded_data => params[:photo]
respond_to do |format|
format.js { render :json => @user) }
end
end
In my Javascript, i have a function that returns the server response, the gist of which is:
function(serverResponse) {
alert(serverResponse);
});
The output of the serverResponse happens to be a string!! (Ex:
"{'user': {'name':'photo','link':'http://www.google.com/favicon.ico'}}"
)
Now i just cannot access the link by just doing serverResponse.user.link
because it is not a serialized output. How do i resolve this problem?