So we have /page.html and /folder/file.bla . We want to load the contents of this file into a text string in some var using jQuery and call some function when we are done loading. How to do it?
/page.html
/folder/file.bla
Get the file using $ .AJAX:
$.ajax({ type: 'GET', url: '/mypage.html', success: function (file_html) { // success alert('success : ' + file_html); } });
$.get('/folder/file.bla', function(data) { var fileContents = data; });
The function that you pass as the second argument to the get() function will be run after loading data from an external URL.
get()
What type of file? If its plain text, this should not be a problem :)
$.get('/folder/file.bla', function(data) { var filetxt = data; // FINISHED GETTING FILE, INSERT CODE });
Source: https://habr.com/ru/post/900168/More articles:Hosting node.js - node.jsJavascript validation file size - javascripthttps://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/900165/custom-appdomainmanager-fails-to-start-runtimehost&usg=ALkJrhjAw6KGuMsGm5Cu6vVPTjCb7kNmwwHow can I effectively initialize this sparse array in Mathematica? - wolfram-mathematicawhat is the # character in the url - htmlsizeof (* this) and structure inheritance - c ++Protobuf-net [de] serializes GameObject (Unity 3D) - protobuf-netCreating a normal distribution chart (Bell chart) using FLOT - normal-distributionHTML Agility Pack RemoveChild - Doesn't Work As Expected - c #Pattern matching in the context of a data frame - rAll Articles