Home
Username:
Password:
Developing iPhone Web Apps Tutorials

Working with XMLHttpRequest / Refining the Selection Code




Visitors to VTC.com will be able to view all introductory videos for each training course.
Free Trial Members will gain access to first three chapters for each training course.
Full Access Members have full access to VTC.com’s entire library of video tutorials.


Learn More

Subtitles of the Movie

Pop-ups behavior now call setup XML request whenever I change its value. That works. Now, I want to get only what has been selected in the pop-up. Now, there's a very simple way of doing this and I'm going to go through it sequentially. It's actually a very, very fast process. It takes much less time to do than to describe it, but I'll show you what I want to do. Instead of getting the elements, using these 2 tag names, the default tag names, I'm going to comment these 2 lines out and I'm only going to execute one of these lines of code and instead of hard coding the currency, I'm going to use pop-up, which is the name here and I'm going to pick its current value. So, I'm going to go out to this URL, retrieve that data and then parse it and pick up whatever value has been returned and I'm going to leave it in the Canadian Rate field and let's just see if it's working. So, I go through the same process of saving it and moving it up to the server and let's see what we have. It's been moved up to the server and now what I want to do is see if it works. When the value is changed, I should be getting only a single item and it's Ñ I'm reusing this field. So, it will always be in that field. So, if I change it to the Canadian dollar, I'm getting 928678, which is the value. Now, if I change it to Euros, I get 14836, which is this value. So, it's working properly. All I need to do is to rename the fields and do a little bit of rearranging and I will have totally implemented this version of getting the rates. What I'm going to do is to come back in the Dashcode and I'm going to take out these labels. I don't need the labels anymore. I'm going to take out this field. I'm going to rename this field, Rate and if I'm going to rename the field, then I'd better remember to immediately change it down here, so I'm filling in that and I'm gonna put the value right next to the pop-up. So it's a nicer interface I'm selecting something here and I will immediately see what the currency conversion rate is for that currency. And I'll do the save, the upload and then we'll take a look and see how it looks now. So, let me refresh this and now I have the field next to the pop-up, Canadian dollar, 928678; Euros, 14836. So, I now have the interface that gets the data, parses only what I need out of it and provides it to me when I need it. And if I come back down here to the actual source code, the only additional change that I need to make is to totally remove this line of code, but I'm going to leave it in as a reminder and I'm not going to rename this one. This could be called Setup Individual XML Request. It doesn't matter, but I'm leaving it here and this code is in the Work Files either on the desk or on the side if you have the online subscription so that you'll be able to look at it and you'll see this is the code to be called either from the load function or from the pop-up. So we now finish the third of the 3 ways of getting data into an iPhone web app other than having a user type something in. So, we are now pretty strongly in the environment where the iPhone web app can communicate bringing data in from whatever resources are needed.

Tutorial Information

Course: Developing iPhone Web Apps
Author: Jesse Feiler
SKU: 34075
ISBN: 1-935320-89-0
Release Date: 2009-12-31
Duration: 8 hrs / 103 lessons
Work Files: Yes
Captions: Available on CD and Online University
Compatibility: Vista/XP/2000, OS X, Linux
QuickTime 7, Flash 8

VTC Sign up & Benefits

  • Unlimited Access
  • 98,729 Video Tutorials (23,265 free)
  • Video Available as Flash or QuickTime
  • Over 1026 Courses
  • $30 for One Month Access
  • Multi-User Discounts Available