javascript - Load json from file uploaded -


i have file input , submit button. file uploaded contains json needs loaded in view, (a graph display). don't need store file, visualize it.

is there way using jquery, javascript or angular? application included static content inside spring app, has function standalone app also.

actually can load file server or make request rest endpoint, need add option load local file json data.

thanks in advance

this work ie >= 10. aware there no fault handling implemented. i'll leave ;)

html:

<input type="file" id="file" name="file"> <button type="submit" id="button">click!</button> 

js (jquery):

$('#button').on('click', function() {     var reader = new filereader();     var file = $('#file').get(0).files[0];     reader.onload = function(e) {         console.log(json.parse(e.target.result));     };     reader.readastext(file); }); 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -

javascript - Restarting Supervisor and effect on FlaskSocketIO -