HighDots Forums  

JS onject explanation needed

JavaScript discussion (multi-lingual) JavaScript discussion (alt.comp.lang.javascript)


Discuss JS onject explanation needed in the JavaScript discussion (multi-lingual) forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
sammy
 
Posts: n/a

Default JS onject explanation needed - 07-05-2009 , 12:11 PM






i have finaly had reason to look at JS, but I can't find any detailed
info on the web about objects.
I trying to create a requiest for GM_xmlhttpRequest()


// obj1 = { method:"POST", url:"192.168.0.6:7777",
// headers:{
// "User-Agent":"monkeyagent",
// "Accept":"text/monkey,text/xml"},
// onload:function(details) {
// alert([
// details.status,
// details.statusText,
// details.readyState,
// details.responseHeaders,
// details.responseText].join("\n")) }
// };

The above is almost verbatim from mozilla docs ( which I can't now find )

obj1 = { method:"POST", url:"http://voidstar:7777",
headers:{
"User-Agent":"monkeyagent",
"Accept":"text/monkey,text/xml",

"Content-type":"application/x-www-form-urlencoded" },
data: "data here?" };

// obj1 = { method:"POST", url:"http://voidstar:7777",
// headers:{
// "User-Agent":"monkeyagent",
// "Accept":"text/monkey,text/xml" }
// };
// obj1.data = response
GM_xmlhttpRequest( obj1 )


I guess I am not sure what is realy happening in the original example.
Is it creating object with method , headers and "?? nameless function"
members?
I have tried:
obj1.data = posted_data_string
but no joy, so how can I add my data string to this?

Many thanks

Reply With Quote
Reply




Thread Tools
Display Modes

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

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



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.