The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Displaying a file instead of downloading it
Loonatic
post Oct 5 2016, 08:36 AM
Post #1





Group: Members
Posts: 5
Joined: 15-June 16
Member No.: 24,325



Good day to all,

Im trying to do a health check webpage, which is checking a few URL for specific wording and displaying the results.

Here is my issue,

I am having some problems with some of the URL which return a file to download instead of displaying it in the browser. When i enter my URL, it ask me to either open or save.

In console with cURL, i am able to display the data with a command similar to this : curl -XGET 'http://localhost:9000/monitor/health?nice=true'

The result look like this
QUOTE
{
"name" : "localhost",
"status" : "red",
"timed_out" : false,
"number_of_nodes" : 1,
"number_of_data_nodes" : 1,
"active_primary" : 1,
"active_vm" : 5,
"relocating_vm" : 0,
"initializing_vm" : 1,
"unassigned_vm" : 4
}


How can i get my webpage to display or echo this result ?

Any help will be appreciated.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Oct 5 2016, 10:20 AM
Post #2


.
********

Group: WDG Moderators
Posts: 9,648
Joined: 10-August 06
Member No.: 7



QUOTE(Loonatic @ Oct 5 2016, 03:36 PM) *

Im trying to do a health check webpage, which is checking a few URL for specific wording and displaying the results.

What are you using to check those URLs? A scripting language, iframes, Ajax?

QUOTE
I am having some problems with some of the URL which return a file to download instead of displaying it in the browser. When i enter my URL, it ask me to either open or save.

See the answer to this FAQ question: http://htmlhelp.com/faq/html/links.html#force-download

QUOTE
In console with cURL, i am able to display the data with a command similar to this : curl -XGET 'http://localhost:9000/monitor/health?nice=true'

The result look like this

Is that a javascript object? In that case you also need a script that can use it. Perhaps you can load it with a SCRIPT element, like this:

CODE
<script src="http://localhost:9000/monitor/health?nice=true"></script>
<script>
// something that uses the embedded JS goes here
</script>

Or you might use Ajax to send the GET request.



User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 16th April 2024 - 07:23 AM