Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently October 4th, 2024, 10:12 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: InternetPostData question
PostPosted: February 1st, 2005, 12:25 am 
In the help for Opus scipt is an example for the InternetPostData function

// To send an Object, first set up the Object:
var obj = new Object()
obj.Name = "John"
obj.Age = 21
obj.ShoeSize = 8
out = InternetPostData(url, obj, true)
// will return an object with Name, Age and ShoeSize members set.

I have been able to get something similiar to work when I just SEND data to the PHP script I use, but can't seem to get data to come back when I use: &stuff=hello world&morestuff=goodbye

the example says data will be returned to an object with Name, Age, and ShoeSize. What is the name of this object? obj? and do I access members of the object in OpusScript after the Post function? what if the members of an object I am Sending are different names than the ones I wish to receive? A little more explanation of this function would help greatly! Thank You!


Top
   
 
 Post subject:
PostPosted: February 1st, 2005, 11:59 am 
Offline

Joined: October 25th, 2004, 12:27 pm
Posts: 526
Location: Digital Workshop
Hi,

Thank you for your enquiry.

I would first recommend setting the URL to your script file to a string:

Code:
var url = "http://yourdomainname.com/scriptfile.php"


Now create the object which will contain the member set:

Code:
var obj = new Object()


Now get the data from the server and store it to a new object named 'output':

Code:
var output = InternetPostData(url,obj,true)


This 'output' object will now have the properties 'Name', 'Age' and 'ShoeSize', defined by the name-value pairs being sent by the server. We can now store these 'properties' to publication variables:

Code:
var Name = output.Name
var Age = output.Age
var ShoeSize = output.ShoeSize


The complete set of script actions should now read as follows:

Code:
var url = "http://yourdomainname.com/scriptfile.php"
var obj = new Object()
var output = InternetPostData(url,obj,true)
var Name = output.Name
var Age = output.Age
var ShoeSize = output.ShoeSize


Now open the properties of your publication, select the Variables tab and create three new publication variables named 'Name', 'Age' and 'ShoeSize' with blank default values.

Finally, create a text object on the page and insert these three variables into the text object. Preview the publication and the values sent by the server should now be displayed.

I hope this helps. Please do not hesitate to contact me if you have any further queries.

Kind regards,

_________________
Robin Garrett
Digital Workshop Technical Support


Top
 Profile Visit website  
 
 Post subject:
PostPosted: February 2nd, 2005, 1:01 am 
Yes, that helped!
That is exactly what I was looking for!

Thank you!


Top
   
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group