javascript - Need to replace my data from json to csv file -


i'm working json file need replace csv file. need use library or can change jquery json csv? i've tried no luck not working.

my javascript code th

$(document).ready(function() {  	$.ajax({  		url: 'somefile.json',  		type: "get",  		datatype: "json",  		success: function (data) {  			$(".score-text").each(function( index, value ) {           		value.innertext = data['box'+(index+1)].total;      		});            		$(".data").each(function( index, value ) {            		var boxindex = math.floor(index/4);          		width = data['box'+(boxindex+1)]['bar'+(index+1-boxindex*4)];          		value.innertext = width;          		value.style.width = width;      		});  		}  	});     });

i'm using csv array getting errors code

$(document).ready(function() {  	$.ajax({      	url: "somefile.csv",      	success: function (csvd) {          	data = $.csv2array(csvd);      	},      	datatype: "text",      	complete: function (data) {          	$(".score-text").each(function( index, value ) {           		console.log(data);          		value.innertext = data['box'+(index+1)].total;      		});            		$(".data").each(function( index, value ) {            		var boxindex = math.floor(index/4);          		width = data['box'+(boxindex+1)]['bar'+(index+1-boxindex*4)];          		value.innertext = width;          		value.style.width = width;      		});      	}  	});    });

thanks

jquery not know csv files. need request datatype: "text", parse yourself.


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -