We are working on the application where we need to call the scanner device to scan the image. We use DynamicWebTwain. Using the ''HTTPUploadThroughPost'' method we upload the image to the URL. It''s all fine. We need to return the saved image id from the controller action as Http response. How to send the Http response back to this javascript? function btnUpload_onclick(court_id) { var strActionPage; var strHostIP; var CurrentPathName = unescape(location.pathname); var CurrentPath = CurrentPathName.substring(0, CurrentPathName.lastIndexOf("/") + 1); strActionPage = CurrentPath + "court_images/save_image?court_id="+court_id; frmScan.DynamicWebTwain1.HTTPPort = 3000; frmScan.DynamicWebTwain1.HTTPUploadThroughPost("localhost", 0, strActionPage, "imageData.pdf"); if (frmScan.DynamicWebTwain1.ErrorCode != 0) { alert(frmScan.DynamicWebTwain1.HTTPPostResponseString); } else frmScan.submit(); } -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Can some one in the group help me out for this issue.. Thanks. Ratnavel -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I may be naive in this area, but it is not entirely clear to me how this interacts with Rails, which may be why you have not had a reply. It appears to me that the javascript runs from the browser, pulling the image data from the TWAIN server and you then post it to the Rails App. If that is correct, then does can the rails action that receives the request with the image data not return the id to the browser. Is it not the frmScan submit that sends a standard post request with the data to the Rails app? Sorry this is a question rather than an answer, but it may help get the ball rolling so that someone else may also be able to help. Tonypm --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Could that be done with RJS? Set the ID in the controller method (e.g. @id = image.id) and than pass it to the JS function in the RJS. page.call("btnUpload_onclick", @id) On 23 Jun., 09:56, Ayyanar Aswathaman <rails-mailing-l...@andreas- s.net> wrote:> We are working on the application where we need to call the scanner > device > to scan the image. We use DynamicWebTwain. Using the > ''HTTPUploadThroughPost'' > method we upload the image to the URL. It''s all fine. > > We need to return the saved image id from the controller action > as Http response. How to send the Http response back to this javascript? > > function btnUpload_onclick(court_id) > { > var strActionPage; > var strHostIP; > > var CurrentPathName = unescape(location.pathname); > var CurrentPath = CurrentPathName.substring(0, > CurrentPathName.lastIndexOf("/") + 1); > strActionPage = CurrentPath + > "court_images/save_image?court_id="+court_id; > frmScan.DynamicWebTwain1.HTTPPort = 3000; > frmScan.DynamicWebTwain1.HTTPUploadThroughPost("localhost", 0, > strActionPage, "imageData.pdf"); > if (frmScan.DynamicWebTwain1.ErrorCode != 0) { > alert(frmScan.DynamicWebTwain1.HTTPPostResponseString); > } > else > frmScan.submit();} > > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---