سؤال

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?

هل كانت مفيدة؟

المحلول

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top