Advertisement
mralston

New category Javascript

Jan 13th, 2012
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.73 KB | None | 0 0
  1. <script type="text/javascript">
  2.    
  3.     // Lots of code removed here!
  4.    
  5.     var options={
  6.       method: 'get',
  7.       parameters: 'inCatName='+ele.value,
  8.       onSuccess: function(xhr) {
  9.           // Find the categories <div>
  10.           var divCategories=document.getElementById('divCategories');
  11.          
  12.           // Add the newly created category to the categories <div>
  13.           divCategories.innerHTML+='<p>'+ele.value+'</p>';
  14.       },
  15.       onFailure: function(xhr) {
  16.           // ...
  17.       }
  18.     };
  19.    
  20.     // More missing code...
  21.  
  22. </script>
  23.  
  24.  
  25. <!--
  26. This is the categories loaded from the database when the page first loaded.
  27. It's been wrapped in <div> so that the Javascript can alter it
  28. -->
  29. <div id="divCategories">
  30.     <p>Category 1</p>
  31.     <p>Category 2</p>
  32. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement