Ajax call from Bookmarklet

后端 未结 2 988
情深已故
情深已故 2020-12-15 11:22

I am trying to create a bookmarklet that, upon clicking, would request some information from the user (a url and a couple other fields in this case) and then send that data

2条回答
  •  北荒
    北荒 (楼主)
    2020-12-15 11:58

    You won't be able to do a post, but a GET will work fine. If you're using something like jQuery, it will simply create a script tag with a src URL which would send the data you are looking to submit.

    You will have to return JSON style data.

    See: http://docs.jquery.com/Ajax/jQuery.getJSON

    Alternatively, your bookmarklet could create an iframe on the page, and that could do you work of submitting the data (you could use post then) if you weren't looking to communicate between the iframe and the page itself, but instead just use user input to submit.

提交回复
热议问题