开发者

Is it possible to send non POST data with javascript?

I'm trying to submit a postscript print jo开发者_开发问答b directly to printer on port 9100. I tried submitting a form directly to the IP and port, but it includes a lot of header information which obviously messes it up.

Is there a way to do this with jQuery or AJAX (or some other term I don't know about)?


You can't do it with Javascript, it'll only do HTTP requests (e.g. POST/GET), which means you get the full HTTP headers included.

Once WebSockets get more widespread, you could use those and send arbitrary data without the HTTP overhead/payload, but at present, that's only in 'bleeding edge' browsers.

This means you're stuck using a Flash or Java applet at present.


You can create a proxy php script which will accept your POST data from the form, format this data and send it to the printer

If you'd like to submit data to this script in background - please see my answer to the following post:
JavaScript: How do I create JSONP?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜