You are here

URL Data Object

This object is used to send data to a server.  It is similar to the Server Communication object built into SmartBuilder, except for the following differences:

  • It can send data across domains, and
  • the lesson does not wait for a response from said server.

Typical uses for a URL Data object include sending information to a server where server-side script will capture it, or launching a certain page or search results based on data captured in SmartBuilder.  See this forum post for more information on how to use it.

Samples using the URL Data object

Here is a sample action that will send an update command with a value being passed along.  Of course, there needs to exist some sort of server-side script that can store this in a database.  Essentially this is the same as entering http://www.website.com/serverScript.php?query=update&q1=45&q2=2009 into the address bar of your browser.

Trigger: Submit Button > onClick
Response: URL widget > addParam > "query" = "update"
Response: URL widget > addParam > "q1" = "45"
Response: URL widget > addParam > "q2" = InputText 1 > getText
Response: URL widget > setURL > "http://www.website.com/serverScript.php"
Response: URL widget > invoke

Here is an example of sending a search query to google, essentially the equivalent of entering "http://www.google.com/search?q=e-learning" into the address bar of your browser.  Since it automatically shows a bunch of search results and changes the webpage, it would make sense to invoke this in a new window so that it doesn't navigate away from your lesson.

Trigger: Submit Button > onClick
Response: URL widget > addParam > "q" = "e-learning"
Response: URL widget > setURL > "http://www.google.com/search"
Response: URL widget > invokeInNewWindow

Note: When using the "invoke" method, another name value pair is appended at the end of the url.  This is "&rand=1111111111111", where the string of 1s is a randomly generated number.  This is to prevent caching and the same value being ignored if sent multiple times.  Your server-side script should allow for this value to be received, but it can disregard it (basically, just make sure that your script can handle this extra data without breaking).  This is currently not the case with "invokeInNewWindow" method, but this method may be updated in the near future as well to keep everything consistent.