I want to include json file on javascript in node application. I have include using "require();"
. But i have face error:
"Uncaught ReferenceError: require is not defined".
In client side Javascript require
won't work. Instead of this use jQuery.getJson()
$.getJSON( "json_file.json", function( data ) {
//data variable having your json data
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.