paulon

Untitled

Jan 13th, 2015
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var loadTaxRate = {
  2.          type:'dropdown',
  3.          source: function(){
  4.             var xmlhttp;
  5.             if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
  6.                xmlhttp=new XMLHttpRequest();
  7.             }else{// code for IE6, IE5
  8.                xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  9.             }
  10.  
  11.             xmlhttp.onreadystatechange=function(){
  12.                if (xmlhttp.readyState==4 && xmlhttp.status==200){
  13.                   var data=[];
  14.  
  15.                   _.each(xmlhttp.responseText,function(x,y){
  16.                      console.log(x, y);
  17.                      data.push(y);
  18.                   });
  19.                   return {type:'dropdown',source:data};
  20.                }
  21.             }
  22.             xmlhttp.open("POST","/api/xero/get/taxrates",true);
  23.             xmlhttp.send();  
  24.            
  25.            
  26.          }  
  27.       };
Advertisement
Add Comment
Please, Sign In to add comment