473,396 Members | 1,871 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to import file inside javascript

10
Hi.
I want to import a file inside javascript..
for ex:<%@page import="java.util.ArrayList">
how i can import this file inside javascript
May 26 '10 #1
4 2075
Dormilich
8,658 Expert Mod 8TB
if you have this file on the server, you can import its text content via AJAX. the text is then available through the .responseText property (given that the file is not processed on the server).
May 26 '10 #2
aaaash
10
@Dormilich
Can u plz tell how we can import its text content via AJAX. i have no idea abt AJAX. Can't we import using javascript?
May 26 '10 #3
Dormilich
8,658 Expert Mod 8TB
as I said, do a simple AJAX request.
Expand|Select|Wrap|Line Numbers
  1. // a very basic procedure, may not work in IE (kindly refer to the link on the bottom of this post for further information)
  2. var xhr = new XMLHttpRequest();
  3. xhr.open("POST", "your_file.txt", false);
  4. xhr.send();
  5. var txt = xhr.responseText;
  6. // now you have the content of "your_file.txt" in the txt variable
further introductions & tutorials you can find in our Offsite Links, AJAX section.
May 26 '10 #4
aaaash
10
@Dormilich
ok thank you..
May 26 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Newsgroup - Ann | last post by:
I have a library function like GetOptions( ..., struct net_arch_t netArch, ....) and put the declaration into a regular header file like getopt.h. But this function declaration also needs the...
1
by: Matt | last post by:
Is it possible to put XSL instructions inside JavaScript? For example, pop up a message box with the xml value: alert(value in xml); Approach #1: <script type="text/javascript">...
1
by: Frederik S | last post by:
Hi all, Is it possble to do a HTTP post request inside JavaScript? - That is I don't want to use a HTML FORM, but need a JavaScript to post a value to a PHP script not encoding the parameters...
2
by: Eric Caron | last post by:
Hi I try to import file in a dataset. How I can do this ?
11
by: kaisersose1995 | last post by:
Hi, I've got an import procedure working, using a standard import specification to import a .csv file into a temporary table. The problem i'm having is that i have 4 different sets of borrower...
2
by: kalaivanan | last post by:
hi, how do i embedd html tag inside javascript alert message. for example alert("hi, have a "+<B"great day!"</B>); i want the output as: hi, have a great day!
2
Atran
by: Atran | last post by:
Hello: How I can import a file to my program, and export the file from my program. Example: You see that html pages have images. So I want my program has a file inside it. Example: in Html...
2
by: gaya3 | last post by:
hi all, I have retreive arraylist values inside javascript... using loops i need to get it... please any one help me... Thanks in advance. -Hamsa
11
by: raknin | last post by:
Hi, Is there any way to call html file from a javascript. What I want to do is as following: 1) send information to sever and checkit by using Javascript. 2) if everything is OK. call...
3
by: swethak | last post by:
Hi, i am getting the problem with php code inside javascript function in Internet Explorer.Here is my javascript and php code. function addPoints() { <? ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.