Thanks, Fred. Though it looks a bit more complicated. I was going to
test your suggestion and so stuck a breakpoint in proxy_controller
before the send_data:
response = Net::HTTP.start(uri.host, uri.port) { |http|
http.request_post(uri.path, claim, { 'Content-type' => 'text/
turtle' })
}
debugger
send_data(response.body, :type => response['content-type'],
:status => "#{response.code} #{response.message}")
but the javascript completed before I could get to the debugger. The
js (using prototype) looks like:
new Ajax.Request('/proxy',
{
method:'post',
parameters: { 'claimType': claim_type, 'claimId': claim_id,
'sacURL':sac, 'notes':notes, 'rating':rating, 'tags':tags.toString
() },
onSuccess: function(transport){
alert('Added claim at: ' + transport.body);
Shadowbox.close();
return;
},
onFailure: function(transport){
alert('Something went wrong...\nProbably incorrect SAC address\n
\nStatus: ' + transport.status + 'Text: ' + transport.responseText);
Shadowbox.close();
return;
}
});
so it looks as though the post is coming back as successful before the
proxy_controller can do the send_data though the page is held up from
refreshing until proxy_controller completes.
Why would this be? I thought the post to /proxy would not know whether
the post was complete and successful or not (same thing happens if I
change onSuccess to onComplete) until the proxy_controller has
finished.
Hmm, maybe the post is asynch. I'll do some more digging but any
suggestions meantime would be appreciated.
Cheers,
Tony.
On Nov 25, 11:12 am, Frederick Cheung <[EMAIL PROTECTED]>
wrote:
>
> It just does. send_data won't unset headers previously set.
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---