Advertisement
GWibisono

ajax sederhana

Jun 14th, 2012
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. sayangnya saya bingung kl pake ajax.. tp ini
  3. yg mungkin bs dipake
  4. versi sederhananya
  5. */
  6.  
  7.     $(".doc").change(function () {
  8.         var str = "";
  9.           $(".doc option:selected").each(function () {                
  10.                 id=$(this).val();
  11.                 //alert(id);
  12.               });
  13.          url2='index2.php?option=com_hrd&view=nilai&t=work&l=form&doc='+id+'&t1=<?=mktime();?>';    
  14.          $.get(url2, function(data) {
  15.            $('.docEdit').html(data);
  16.           });
  17.            
  18.        
  19.     }).change();
  20.  
  21.     $("#cariItem").keyup(function(){
  22.         pos=$("#cariItem").val();
  23.         url= 'index2.php?option=com_ri&l=l&t=item ';
  24.         /*
  25.         $("#listItem").load(url);
  26.         */
  27.         $.post(  
  28.             url,  
  29.             {language: "php", version: 5, cari:pos},  
  30.             function(responseText){  
  31.                 $("#listItem").html(responseText);  
  32.             },  
  33.             "html"  
  34.         );  
  35.     });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement