Answer the question
In order to leave comments, you need to log in
AJAX file read?
I can't find a cross-browser script that would support all ajax requests.
I have a task to open a file to read the file as json or at least as a text string in general. But the trouble is, I don’t know how to do without jquery, but how can I do it without it? So that IE6+ is also involved.
Answer the question
In order to leave comments, you need to log in
If the file is a valid json, then you can load it using
en.wikipedia.org/wiki/JSONP
This approach bypasses the Same Origin Policy in some situations.
Do you have a cross-domain file transfer?
If I understand you correctly, yql will help you.
They are quite good for themselves, and it’s quite possible for them to bypass protection against cross-domain requests even cross-browser. I parsed them like a website.
developer.yahoo.com/yql/console
Then the final line, you hide your usual ajax jquery function.
if it's stupid to load, then ("").load()
https://api.jquery.com/load/
there are actually 2 questions. how to work with xhr directly without jQuery and what to do with json string in IE6? @fart
's first question was answered by
the second question is not so simple. all recent versions of browsers have a built-in JSON object that serializes and deserializes. Unfortunately IE6 doesn't do that. caniuse.com/#search=json
uses a third-party library of the same name for this. googling easily.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question