Guest User

Untitled

a guest
Jan 23rd, 2013
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <form id="search">
  2.         <fieldset>
  3.             <label for="area">First digits of postal code:</label>
  4.             <input name="area" type="text" maxlength="4" placeholder="AB12" required />
  5.             <input type="submit" value="Search" name="search" />
  6.         </fieldset>
  7.     </form>
  8.    
  9.    
  10.    
  11.     <script type="text/javascript" src="jquery/jquery.min.js"></script>
  12.     <script type="text/javascript" src="cordova-2.3.0.js"></script>
  13.     <script type="text/javascript" src="js/index.js"></script>
  14.     <script type="text/javascript">
  15.     $(function(){
  16.         $('#search').submit(function(event){
  17.         event.preventDefault(); // <-- prevent form submission
  18.                 $.ajax({
  19.                     url: 'http://www.entertainmentcocktail.com/cp/index.php?area=AB12',
  20.                     dataType: 'jsonp',
  21.                     jsonp: 'jsoncallback',
  22.                     timeout: 5000,
  23.                     success: function(data, status){
  24.                         $.each(data, function(i,item){
  25.                             var place = '<h1>'+item.location+'</h1>'
  26.                             + '<p>'+item.id+'</br>';
  27.            
  28.                             output.append(place);
  29.                         });
  30.                     },
  31.                     error: function(){
  32.                         output.text('There was an error loading the data.');
  33.                     }
  34.                 });
  35.             });
  36.     });
  37.            
  38.             </script>
  39.            
  40.             <div id="place">
  41.             <h3>Places near your location</h3>
  42.             </div>
Advertisement
Add Comment
Please, Sign In to add comment