feedback.js server api

大兔子大兔子 提交于 2019-12-04 21:18:29

问题


feedback.js is a great jquery plugin that allows you to create feedback forms which include a screenshot, created on the clients browser, along with the form.

how can I send captured image and user's review to server side api?


回答1:


Indeed, feedback.js is an incredible piece of javascript. Thank you very much, Niklas von Hertzen! It does not depend on jQuery, though, but you can use both in the same page.

You can send the image to a server by passing the 'url' option. The Feedback function supports many options, for example:

Feedback({h2cPath:'/js/html2canvas.js',
          url: '/send/email/uri/on/server',
          label: "Send an email",
          header: "Let's send an email!",
          messageSuccess: "Done!",
          messageError: "Uh oh..."
        })
  • h2cPath : the location of the html2canvas.js file (mandatory, other options are optional).
  • url : the URL called when the user submits feedback. This is the answer to your question.
  • label : text of the feedback button.
  • header : header text of popup window.

The URL specified in the url is called using the HTTP POST method, with the image in the 'data' parameter. The image itself is encoded as a DOMString. If you want to know what it contains exactly, look at the specification of toDataURL. Other information that your users have entered comes in other parameters, depending on the form-fields you define.



来源:https://stackoverflow.com/questions/14131022/feedback-js-server-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!