ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
JQUERY MOBILE
WORKSHOP
Ron Reiter
What are we going to do?
?? ProductShop ¨C Product Shopping Application


?? Build a List View using jQuery Mobile (codiqa.com)
?? Make an AJAX call and populate the List View
  ?? http://productshoppingapi.appspot.com/search?q=digital+camera

?? Upload your jQuery Mobile project to Google App Engine
?? Browse using your smartphone / tablet
Codiqa
?? Create an account at http://www.codiqa.com
?? Create a new project called ProductShop
Build the application screen
Build the application screen
?? Form
   ?? Search button
     ?? Placeholder: Search Product¡­
     ?? Name: q
  ?? Submit
     ?? Text: Search
     ?? Icon: Search
     ?? Theme: Blue

?? List View
   ?? Id: products
   ?? Delete the divider
Start Working
?? Download the project to a working directory
Edit app.html
Build the AJAX Search
?? Delete the contents of the list view we created using Codiqa
?? AJAX endpoint - http://productshoppingapi.appspot.com/search?q=<query>
?? The endpoint sends CORS headers so we can use it form anywhere. The back-end is a
   simple Google App Engine Python application which uses the Google Product Search
   API.
?? Once we get the response back, iterate over the items array
?? Empty the #products list view
?? For each item, get the ¡°product¡± item and create a list item:


<li>
  <a href=/slideshow/jquery-mobile-workshop/16896843/¡°{{ item.product.link }}¡±>
     <img src=/slideshow/jquery-mobile-workshop/16896843/¡°{{ item.product.images[0].link }}¡±/>
     {{ item.product.title }}
  </a>
</li>

?? Finally, refresh using $(¡°#products¡±).listview(¡°refresh¡±).
AJAX Search Code
// run this code only after initialization
$(function() {
  // handle search form submit
  $("form").submit(function(event) {
    // prevent the default submit behavior
    event.preventDefault();
    // prepare the query URL
    var url = "http://productshoppingapi.appspot.com/search?" +
      $(this).serialize();
    // make the AJAX request, and iterate over the results
    $.getJSON(url, function(data) {
      resetProducts();
      for (var i = 0; i < data.items.length; i++) {
        var product = data.items[i].product;
        addProduct(product);
      }
      $("#products").listview("refresh");
    });
  });
});
ResetProducts
function resetProducts() {
  $("#products").empty();
   var divider = $("<li data-role='list-
divider'>Search Results</li>");
  $("#products").append(divider);
}
addProduct
function addProduct(product) {
  var productView = $("<li><a href=/slideshow/jquery-mobile-workshop/16896843/& +
    product.link + "'><img src=/slideshow/jquery-mobile-workshop/16896843/& +
    product.images[0].link + "'/> " +
    product.title + "</a></li>");
  $("#products").append(productView);
}
Uploading to Google App Engine
?? Download Python if you¡¯re on Windows
?? Download the GAE Python SDK
?? Go to http://appengine.google.com/ and create a new app (you¡¯ll need
   to do SMS account activation)
?? Choose an identifier
?? Create a new Google App Engine app with the identifier through the
   Google App Engine Launcher
?? Add your directory (codiqa-app) to your project directory
?? Add the following to app.yaml:

- url: /app
  static_dir: codiqa-app

?? Upload through the Google App Engine Launcher
?? Access <youridentifier>.appspot.com/app/app.html through your
   mobile phone or tablet
?? You¡¯re done!
Reference
?? Download everything from here:
   ?? https://github.com/ronreiter/productsearch
Ad

Recommended

Multi screen HTML5
Multi screen HTML5
Ron Reiter
?
Introduction to App Engine Development
Introduction to App Engine Development
Ron Reiter
?
Apex & jQuery Mobile
Apex & jQuery Mobile
Christian Rokitta
?
Google app-engine-with-python
Google app-engine-with-python
Deepak Garg
?
Web Components: The future of Web Application Development
Web Components: The future of Web Application Development
Jermaine Oppong
?
Gae Meets Django
Gae Meets Django
fool2nd
?
SwiftUI and Combine All the Things
SwiftUI and Combine All the Things
Scott Gardner
?
jQuery Intro
jQuery Intro
Jason Noble
?
Ajax on drupal the right way - DrupalCamp Campinas, S?o Paulo, Brazil 2016
Ajax on drupal the right way - DrupalCamp Campinas, S?o Paulo, Brazil 2016
Nicol¨¢s Bouhid
?
MVVM with SwiftUI and Combine
MVVM with SwiftUI and Combine
Tai Lun Tseng
?
Unobtrusive JavaScript
Unobtrusive JavaScript
Vitaly Baum
?
Drupal and diversity of Single sign-on systems
Drupal and diversity of Single sign-on systems
Alex S
?
Getting Started with Combine And SwiftUI
Getting Started with Combine And SwiftUI
Scott Gardner
?
Angular2 and TypeScript
Angular2 and TypeScript
David Giard
?
jQuery Mobile with HTML5
jQuery Mobile with HTML5
madhurpgarg
?
Building Universal Web Apps with React ForwardJS 2017
Building Universal Web Apps with React ForwardJS 2017
Elyse Kolker Gordon
?
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
murtazahaveliwala
?
Cloud Endpoints _Polymer_ Material design by Martin G?rner
Cloud Endpoints _Polymer_ Material design by Martin G?rner
European Innovation Academy
?
Polymer & the web components revolution 6:25:14
Polymer & the web components revolution 6:25:14
mattsmcnulty
?
SenchaCon 2016: Expect the Unexpected - Dealing with Errors in Web Apps
SenchaCon 2016: Expect the Unexpected - Dealing with Errors in Web Apps
Sencha
?
A brave new web - A talk about Web Components
A brave new web - A talk about Web Components
Michiel De Mey
?
AtlasCamp 2015: Using add-ons to build add-ons
AtlasCamp 2015: Using add-ons to build add-ons
Atlassian
?
Web Components + Backbone: a Game-Changing Combination
Web Components + Backbone: a Game-Changing Combination
Andrew Rota
?
The Complementarity of React and Web Components
The Complementarity of React and Web Components
Andrew Rota
?
Controller in AngularJS
Controller in AngularJS
Brajesh Yadav
?
Google Polymer Framework
Google Polymer Framework
Kostas Karolemeas
?
AtlasCamp 2015: Web technologies you should be using now
AtlasCamp 2015: Web technologies you should be using now
Atlassian
?
Advanced JQuery Mobile tutorial with Phonegap
Advanced JQuery Mobile tutorial with Phonegap
Rakesh Jha
?
Creating web api and consuming part 2
Creating web api and consuming part 2
Dipendra Shekhawat
?
Making mobile apps with web technology (revised)
Making mobile apps with web technology (revised)
Manyoung Cho
?

More Related Content

What's hot (20)

Ajax on drupal the right way - DrupalCamp Campinas, S?o Paulo, Brazil 2016
Ajax on drupal the right way - DrupalCamp Campinas, S?o Paulo, Brazil 2016
Nicol¨¢s Bouhid
?
MVVM with SwiftUI and Combine
MVVM with SwiftUI and Combine
Tai Lun Tseng
?
Unobtrusive JavaScript
Unobtrusive JavaScript
Vitaly Baum
?
Drupal and diversity of Single sign-on systems
Drupal and diversity of Single sign-on systems
Alex S
?
Getting Started with Combine And SwiftUI
Getting Started with Combine And SwiftUI
Scott Gardner
?
Angular2 and TypeScript
Angular2 and TypeScript
David Giard
?
jQuery Mobile with HTML5
jQuery Mobile with HTML5
madhurpgarg
?
Building Universal Web Apps with React ForwardJS 2017
Building Universal Web Apps with React ForwardJS 2017
Elyse Kolker Gordon
?
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
murtazahaveliwala
?
Cloud Endpoints _Polymer_ Material design by Martin G?rner
Cloud Endpoints _Polymer_ Material design by Martin G?rner
European Innovation Academy
?
Polymer & the web components revolution 6:25:14
Polymer & the web components revolution 6:25:14
mattsmcnulty
?
SenchaCon 2016: Expect the Unexpected - Dealing with Errors in Web Apps
SenchaCon 2016: Expect the Unexpected - Dealing with Errors in Web Apps
Sencha
?
A brave new web - A talk about Web Components
A brave new web - A talk about Web Components
Michiel De Mey
?
AtlasCamp 2015: Using add-ons to build add-ons
AtlasCamp 2015: Using add-ons to build add-ons
Atlassian
?
Web Components + Backbone: a Game-Changing Combination
Web Components + Backbone: a Game-Changing Combination
Andrew Rota
?
The Complementarity of React and Web Components
The Complementarity of React and Web Components
Andrew Rota
?
Controller in AngularJS
Controller in AngularJS
Brajesh Yadav
?
Google Polymer Framework
Google Polymer Framework
Kostas Karolemeas
?
AtlasCamp 2015: Web technologies you should be using now
AtlasCamp 2015: Web technologies you should be using now
Atlassian
?
Advanced JQuery Mobile tutorial with Phonegap
Advanced JQuery Mobile tutorial with Phonegap
Rakesh Jha
?
Ajax on drupal the right way - DrupalCamp Campinas, S?o Paulo, Brazil 2016
Ajax on drupal the right way - DrupalCamp Campinas, S?o Paulo, Brazil 2016
Nicol¨¢s Bouhid
?
MVVM with SwiftUI and Combine
MVVM with SwiftUI and Combine
Tai Lun Tseng
?
Unobtrusive JavaScript
Unobtrusive JavaScript
Vitaly Baum
?
Drupal and diversity of Single sign-on systems
Drupal and diversity of Single sign-on systems
Alex S
?
Getting Started with Combine And SwiftUI
Getting Started with Combine And SwiftUI
Scott Gardner
?
Angular2 and TypeScript
Angular2 and TypeScript
David Giard
?
jQuery Mobile with HTML5
jQuery Mobile with HTML5
madhurpgarg
?
Building Universal Web Apps with React ForwardJS 2017
Building Universal Web Apps with React ForwardJS 2017
Elyse Kolker Gordon
?
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
murtazahaveliwala
?
Cloud Endpoints _Polymer_ Material design by Martin G?rner
Cloud Endpoints _Polymer_ Material design by Martin G?rner
European Innovation Academy
?
Polymer & the web components revolution 6:25:14
Polymer & the web components revolution 6:25:14
mattsmcnulty
?
SenchaCon 2016: Expect the Unexpected - Dealing with Errors in Web Apps
SenchaCon 2016: Expect the Unexpected - Dealing with Errors in Web Apps
Sencha
?
A brave new web - A talk about Web Components
A brave new web - A talk about Web Components
Michiel De Mey
?
AtlasCamp 2015: Using add-ons to build add-ons
AtlasCamp 2015: Using add-ons to build add-ons
Atlassian
?
Web Components + Backbone: a Game-Changing Combination
Web Components + Backbone: a Game-Changing Combination
Andrew Rota
?
The Complementarity of React and Web Components
The Complementarity of React and Web Components
Andrew Rota
?
Controller in AngularJS
Controller in AngularJS
Brajesh Yadav
?
AtlasCamp 2015: Web technologies you should be using now
AtlasCamp 2015: Web technologies you should be using now
Atlassian
?
Advanced JQuery Mobile tutorial with Phonegap
Advanced JQuery Mobile tutorial with Phonegap
Rakesh Jha
?

Similar to jQuery Mobile Workshop (20)

Creating web api and consuming part 2
Creating web api and consuming part 2
Dipendra Shekhawat
?
Making mobile apps with web technology (revised)
Making mobile apps with web technology (revised)
Manyoung Cho
?
Intro to Jquery Mobile
Intro to Jquery Mobile
James Quick
?
Bd conf sencha touch workshop
Bd conf sencha touch workshop
James Pearce
?
HTML5 and the dawn of rich mobile web applications pt 2
HTML5 and the dawn of rich mobile web applications pt 2
James Pearce
?
Reservoir Apps CMS & Tabs
Reservoir Apps CMS & Tabs
Optimum Entertainment
?
Jarv.us Showcase ¡ª SenchaCon 2011
Jarv.us Showcase ¡ª SenchaCon 2011
Chris Alfano
?
Designing beautiful REST APIs
Designing beautiful REST APIs
Tomek Cejner
?
JavaScript APIs - The Web is the Platform
JavaScript APIs - The Web is the Platform
Robert Nyman
?
supermediastore_mobileapp
supermediastore_mobileapp
David Ko
?
iPhone offline webapps
iPhone offline webapps
Home
?
Making mobile apps with web technology
Making mobile apps with web technology
Manyoung Cho
?
Shopsial TVSS week 3
Shopsial TVSS week 3
shopsial
?
Mat Marquis - JQuery Mobile
Mat Marquis - JQuery Mobile
Harvard Web Working Group
?
jQuery Mobile and JavaScript
jQuery Mobile and JavaScript
Gary Yeh
?
E2 appspresso hands on lab
E2 appspresso hands on lab
NAVER D2
?
E3 appspresso hands on lab
E3 appspresso hands on lab
NAVER D2
?
¥¹¥Þ©`¥È¥Õ¥©¥ó¥µ¥¤¥È¤Î×÷³ÉÐg - ´ó´¨ÑóÒ»
¥¹¥Þ©`¥È¥Õ¥©¥ó¥µ¥¤¥È¤Î×÷³ÉÐg - ´ó´¨ÑóÒ»
okyawa
?
Internship_p.pptx the development of chatbot using OpenAI API
Internship_p.pptx the development of chatbot using OpenAI API
Abhishek934304
?
Create a mobile web app with Sencha Touch
Create a mobile web app with Sencha Touch
James Pearce
?
Creating web api and consuming part 2
Creating web api and consuming part 2
Dipendra Shekhawat
?
Making mobile apps with web technology (revised)
Making mobile apps with web technology (revised)
Manyoung Cho
?
Intro to Jquery Mobile
Intro to Jquery Mobile
James Quick
?
Bd conf sencha touch workshop
Bd conf sencha touch workshop
James Pearce
?
HTML5 and the dawn of rich mobile web applications pt 2
HTML5 and the dawn of rich mobile web applications pt 2
James Pearce
?
Jarv.us Showcase ¡ª SenchaCon 2011
Jarv.us Showcase ¡ª SenchaCon 2011
Chris Alfano
?
Designing beautiful REST APIs
Designing beautiful REST APIs
Tomek Cejner
?
JavaScript APIs - The Web is the Platform
JavaScript APIs - The Web is the Platform
Robert Nyman
?
supermediastore_mobileapp
supermediastore_mobileapp
David Ko
?
iPhone offline webapps
iPhone offline webapps
Home
?
Making mobile apps with web technology
Making mobile apps with web technology
Manyoung Cho
?
Shopsial TVSS week 3
Shopsial TVSS week 3
shopsial
?
jQuery Mobile and JavaScript
jQuery Mobile and JavaScript
Gary Yeh
?
E2 appspresso hands on lab
E2 appspresso hands on lab
NAVER D2
?
E3 appspresso hands on lab
E3 appspresso hands on lab
NAVER D2
?
¥¹¥Þ©`¥È¥Õ¥©¥ó¥µ¥¤¥È¤Î×÷³ÉÐg - ´ó´¨ÑóÒ»
¥¹¥Þ©`¥È¥Õ¥©¥ó¥µ¥¤¥È¤Î×÷³ÉÐg - ´ó´¨ÑóÒ»
okyawa
?
Internship_p.pptx the development of chatbot using OpenAI API
Internship_p.pptx the development of chatbot using OpenAI API
Abhishek934304
?
Create a mobile web app with Sencha Touch
Create a mobile web app with Sencha Touch
James Pearce
?
Ad

More from Ron Reiter (9)

Securing your Bitcoin wallet
Securing your Bitcoin wallet
Ron Reiter
?
Brogramming - Python, Bash for Data Processing, and Git
Brogramming - Python, Bash for Data Processing, and Git
Ron Reiter
?
BDX 2015 - Scaling out big-data computation & machine learning using Pig, Pyt...
BDX 2015 - Scaling out big-data computation & machine learning using Pig, Pyt...
Ron Reiter
?
Introduction to Bootstrap
Introduction to Bootstrap
Ron Reiter
?
Mobile Spaces
Mobile Spaces
Ron Reiter
?
Building Chrome Extensions
Building Chrome Extensions
Ron Reiter
?
HTML5 New Features and Resources
HTML5 New Features and Resources
Ron Reiter
?
Digital Audio & Signal Processing (Elad Gariany)
Digital Audio & Signal Processing (Elad Gariany)
Ron Reiter
?
Writing HTML5 Web Apps using Backbone.js and GAE
Writing HTML5 Web Apps using Backbone.js and GAE
Ron Reiter
?
Securing your Bitcoin wallet
Securing your Bitcoin wallet
Ron Reiter
?
Brogramming - Python, Bash for Data Processing, and Git
Brogramming - Python, Bash for Data Processing, and Git
Ron Reiter
?
BDX 2015 - Scaling out big-data computation & machine learning using Pig, Pyt...
BDX 2015 - Scaling out big-data computation & machine learning using Pig, Pyt...
Ron Reiter
?
Introduction to Bootstrap
Introduction to Bootstrap
Ron Reiter
?
Building Chrome Extensions
Building Chrome Extensions
Ron Reiter
?
HTML5 New Features and Resources
HTML5 New Features and Resources
Ron Reiter
?
Digital Audio & Signal Processing (Elad Gariany)
Digital Audio & Signal Processing (Elad Gariany)
Ron Reiter
?
Writing HTML5 Web Apps using Backbone.js and GAE
Writing HTML5 Web Apps using Backbone.js and GAE
Ron Reiter
?
Ad

jQuery Mobile Workshop

  • 2. What are we going to do? ?? ProductShop ¨C Product Shopping Application ?? Build a List View using jQuery Mobile (codiqa.com) ?? Make an AJAX call and populate the List View ?? http://productshoppingapi.appspot.com/search?q=digital+camera ?? Upload your jQuery Mobile project to Google App Engine ?? Browse using your smartphone / tablet
  • 3. Codiqa ?? Create an account at http://www.codiqa.com ?? Create a new project called ProductShop
  • 5. Build the application screen ?? Form ?? Search button ?? Placeholder: Search Product¡­ ?? Name: q ?? Submit ?? Text: Search ?? Icon: Search ?? Theme: Blue ?? List View ?? Id: products ?? Delete the divider
  • 6. Start Working ?? Download the project to a working directory
  • 8. Build the AJAX Search ?? Delete the contents of the list view we created using Codiqa ?? AJAX endpoint - http://productshoppingapi.appspot.com/search?q=<query> ?? The endpoint sends CORS headers so we can use it form anywhere. The back-end is a simple Google App Engine Python application which uses the Google Product Search API. ?? Once we get the response back, iterate over the items array ?? Empty the #products list view ?? For each item, get the ¡°product¡± item and create a list item: <li> <a href=/slideshow/jquery-mobile-workshop/16896843/¡°{{ item.product.link }}¡±> <img src=/slideshow/jquery-mobile-workshop/16896843/¡°{{ item.product.images[0].link }}¡±/> {{ item.product.title }} </a> </li> ?? Finally, refresh using $(¡°#products¡±).listview(¡°refresh¡±).
  • 9. AJAX Search Code // run this code only after initialization $(function() { // handle search form submit $("form").submit(function(event) { // prevent the default submit behavior event.preventDefault(); // prepare the query URL var url = "http://productshoppingapi.appspot.com/search?" + $(this).serialize(); // make the AJAX request, and iterate over the results $.getJSON(url, function(data) { resetProducts(); for (var i = 0; i < data.items.length; i++) { var product = data.items[i].product; addProduct(product); } $("#products").listview("refresh"); }); }); });
  • 10. ResetProducts function resetProducts() { $("#products").empty(); var divider = $("<li data-role='list- divider'>Search Results</li>"); $("#products").append(divider); }
  • 11. addProduct function addProduct(product) { var productView = $("<li><a href=/slideshow/jquery-mobile-workshop/16896843/& + product.link + "'><img src=/slideshow/jquery-mobile-workshop/16896843/& + product.images[0].link + "'/> " + product.title + "</a></li>"); $("#products").append(productView); }
  • 12. Uploading to Google App Engine ?? Download Python if you¡¯re on Windows ?? Download the GAE Python SDK ?? Go to http://appengine.google.com/ and create a new app (you¡¯ll need to do SMS account activation) ?? Choose an identifier ?? Create a new Google App Engine app with the identifier through the Google App Engine Launcher ?? Add your directory (codiqa-app) to your project directory ?? Add the following to app.yaml: - url: /app static_dir: codiqa-app ?? Upload through the Google App Engine Launcher ?? Access <youridentifier>.appspot.com/app/app.html through your mobile phone or tablet ?? You¡¯re done!
  • 13. Reference ?? Download everything from here: ?? https://github.com/ronreiter/productsearch