【 在 wormhole (虫洞) 的大作中提到: 】
: 搞定了,换了一种同步的方式
: 寻找答案的过程中发现了一个很好的解析csv的库,
https://github.com/henix/csv.js,推荐给大家!
https://www.npmjs.com/package/csv <- use what most people use.
10k+ downloads/day you see?
: <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
: <script type="text/javascript" src="/static/csv.js"></script>
: $.ajaxSetup({
: async : false
: });
synchronous ajax is deprecated. basically you are forced to be async in js.
: var trackPoints=[];
: var parser1 = new CSV.bindColumns(CSV.parse(dataStr,{delim:','}),['longti','lati']);
: for (var i=1; i<parser1.length;i++){
: trackPoints[i-1]= new google.maps.LatLng(parseFloat(parser1[i].lati),parseFloat(parser1[i].longti));
: }
--
FROM 180.173.163.*