Is there any predefined function or any way to open a website url using javascript? as we do in php:
file_get_contents();
How can I open a link using javascript? Without using AJAX or JQuery or Flash
Is there any predefined function or any way to open a website url using javascript? as we do in php:
file_get_contents();
How can I open a link using javascript? Without using AJAX or JQuery or Flash
No, there is no way for JS to load content Asynchronously with out using, to a degree, AJAX. After all, loading Asynchronously is more or less the entire point of AJAX.
Personally, I would say you should just accept using JQuery, whilst it is not the perfect solution to all life's problems, it certainly does the job when it comes to AJAX requests like this.
EDIT
Though, that said, you may be simply wishing to simulate the use clicking a link... but that is a different question entirely.
the simplest way to do this is :
window.location = "url to your document";
and make sure the server adds a header like this:
'Content-Disposition: attachment; filename="downloaded.pdf"'