webOShelp.net

Get the latest on:webOS Developers' RSS FeedwebOS Facebook page webOS Twitter Feed

Home Forums
The webOShelp.net WebOS / Mojo Developers' Forum
October 01, 2014, 04:19:42 PM *
Welcome, Guest. Please login (using the form in the left column) or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Am I missing something or...  (Read 8368 times)
Scott S.
webOS Newb
*
Offline Offline

Posts: 8


View Profile
« on: March 02, 2009, 09:18:17 PM »

...has Palm not yet given an example of how one would get information from a web server into an application?  They explained support for local storage, which is great, but how would you transfer data to and from a remote server?  Huh
Logged
RandiRS4
webOS Newb
*
Offline Offline

Posts: 7


View Profile
« Reply #1 on: March 05, 2009, 06:12:52 PM »

That's true, they're pushing the synergy and web features so much, i'm surprised they focused so much on local processes and data caching
Logged
Ken Young
Administrator
webOS Rookie
*****
Offline Offline

Posts: 76


View Profile
« Reply #2 on: March 11, 2009, 09:47:06 PM »

Sorry for this late response; I just noticed this post!

Palm has been stressing that the webOS application development model is based in no small part on AJAX development:

Quote
You will build WebOS applications with common web development tools following typical design and implementation practices for Ajax applications.

There are AJAX methods for retrieving data from remote servers using Javascript calls.  These will be covered in our upcoming "webOS and AJAX" article.  Smiley
Logged
SeanBlader
webOS Rookie
**
Offline Offline

Posts: 69


View Profile
« Reply #3 on: March 12, 2009, 09:28:11 PM »

You can pull in XML from the server that the application is running on fairly easy, but if you want to pull in something from an external server, your best bet is to use JSON, which is hella easy once you understand it. That's ironically more of a security risk to your Ajax application than XML would be from some other server.

Bottom line, in your application only get data from a server that you trust. Overall though, it's really easy to do if you read the prototype documentation.

Excuse me if I'm a bit biased on the "easy side" there, I've been doing Ajax for a few years now.
Logged
Ken Young
Administrator
webOS Rookie
*****
Offline Offline

Posts: 76


View Profile
« Reply #4 on: March 13, 2009, 03:46:27 PM »

Accomplishing the same thing in an easier way is always better in my book. Smiley

Thanks for the heads up.  I don't have much AJAX experience personally; the only asynchronous Javascript data transfer I've done was actually neither XML nor JSON; just some custom data I was getting to populate some form controls.   I'll try to cover all types of asynchronous data transfer with Javascript.
Logged
SeanBlader
webOS Rookie
**
Offline Offline

Posts: 69


View Profile
« Reply #5 on: March 13, 2009, 05:23:34 PM »

JSON is pretty easy and it's a little easier for the interpreter to read, and it's SO much easier to develop for with Javascript. Here's an example object that I'm using for the config data on my alarm clock:

var data = {
   alarmset: [],
   config:  {
      snooze: 10,
      limit: '1:00',
      tone: '',
      locations: [],
      local: {}
   };

Here's some description:
[] is an array that looks like this: locations = ['Tokyo', 'New York', 'Amsterdam'] And if you wanted to get to the city Amsterdam, you'd use location[2] since arrays start with zero.

{} is an object, and an object is merely a key:value pair. So if you have data = {limit:'1:00'} and if you want to get to the limit of your data object you can use the standard Javascript object notation: data.limit and you're set.

It's when you get into bigger data sets and user generated data that this really becomes useful. So snooze in my object is the number of minutes for the alarm clock to snooze until the next alarm. The limit says to only snooze for that amount of time before just turning off the alarm. Tone lets the user set a default tone for all their alarms, that can be over ridden with an object in each alarm which is in the alarmset array.

The next level benefit of all that is that you can use a very simple function included with prototype to take any object and convert it to a string. Once you have a string you can write it to a cookie and that makes it very nice to use the storage space available to document.cookie to save whole objects and convert them back and forth with just a few lines of code. That's fun stuff.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF | SMF © 2006-2009, Simple Machines LLC
SMF customization services by 2by2host.com
Valid XHTML 1.0! Valid CSS!