Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-21-2013, 05:48 PM   PM User | #1
magi
New to the CF scene

 
Join Date: Apr 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
magi is an unknown quantity at this point
Smile Get info from the "str"

--

Hello.

I have this function and I need to know what there is in the "str"
-------------
function sendPut(str, content) {
var xhr = new XMLHttpRequest();
xhr.open("PUT", "http://" + ipPort + "/" + str);
xhr.send(content);
}
--------
I haver tried
document.writeln( str );
and
document.getElementById
in different ways but not got any "str" data on my website.

Anybody know ??

MagI

--
magi is offline   Reply With Quote
Old 02-21-2013, 08:11 PM   PM User | #2
jmrker
Senior Coder

 
jmrker's Avatar
 
Join Date: Aug 2006
Location: FL
Posts: 2,764
Thanks: 29
Thanked 453 Times in 447 Posts
jmrker will become famous soon enough
One answer at: http://www.webdeveloper.com/forum/sh...t&daysprune=30
jmrker is offline   Reply With Quote
Old 02-21-2013, 09:10 PM   PM User | #3
magi
New to the CF scene

 
Join Date: Apr 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
magi is an unknown quantity at this point
Smile

--
Hi.

I got this suggestion.

Code:
function sendPut(str, content) {  
  alert('Contents of "str": '+str);
  var xhr = new XMLHttpRequest();
  xhr.open("PUT", "http://" + ipPort + "/" + str);
  xhr.send(content);
}


The code "alert('Contents of "str": '+str);" worked almost.
It alert "command.php" from the "sendAction" function.
The command.php have this wiki.
http://code.google.com/p/cellbots/so...mentation.wiki

But I need to know what is in the "str"
It is supposed to be a mailbox message using message wrapping and have this kind of structure
----------------
* Byte 0: 0x80 (direct command with no response from the NXT)
* Byte 1: 0x09 (message command type)
* Byte 2: 0x01 (Mailbox number, 0-9)
* Byte 3: Message Size (including null terminating character)
* Byte 4-N: Message data, where N = Message size + 3 and ends with a null terminating character
-----------------

http://goo.gl/PiqRI
You can read about the message wrapping in PDF Appendix 3 / page 9.


It is a working android code by google and it is called "Cellbots"
http://www.cellbots.com/
http://goo.gl/qKs4p
Here is the code
http://code.google.com/p/cellbots/so...ava%2Fcellbots
And here is the index.html code with my function.
http://code.google.com/p/cellbots/so...ets/index.html


Thanks for your input but this is a hard one.

Is it possible to get the data out of the command.php ?

Regards Magnus
--
magi is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:13 AM.


Advertisement
Log in to turn off these ads.