开发者

POSTing data on a small embedded device

开发者 https://www.devze.com 2023-01-25 01:02 出处:网络
I have a mystery.html page that loads some javascript (as well as mootools). I run a few calculations, and then I need to post this to a url. Seems simple, right?

I have a mystery.html page that loads some javascript (as well as mootools).

I run a few calculations, and then I need to post this to a url. Seems simple, right?

Excep开发者_StackOverflow中文版t:

  • I dont have XMLHttpRequest

  • I can't run createElement to create a FORM and dynamically add my data to it as inputs (and I can have anywhere from a few hundred elements to just one, so I can't pre-create them in my html)

my current thought is to create a FORM in my html with a single INPUT, then create a query string of my resulting parameters, add it to that INPUT, and submit that form. this will probably work, but smells inelegant.

any better suggestions/something obvious I'm missing?

update: turns out that document.write still works, so I can sort of hack my way around this way.


You should really disclose more details about your target. And of course, multiple fields in not a reason, because document.urform.innerHTML += '<INPUT TYPE="TEXT" NAME="foo" VALUE="bar"><INPUT TYPE="TEXT" NAME="baz" VALUE="42">' will do the work.

0

精彩评论

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