Solved

HTML page - Continuous GET request

Posted on 2014-03-20
3
291 Views
Last Modified: 2014-04-20
This is my first time dabbling in HTML, AJax, JQuery etc....  That said, I have a server app which I'm able to test by simply launching a browser and typing:   http://localhost:15084/testService.

The browser in turn initiates a GET request and the services responds with XML which is displayed in the browser.   Next step is to send continuous GET requests (i.e. a continuous loop or loop N times).   The question:  Can I create an HTML page which I'll load within the browser to achieve my objective?  If yes, what does that HTML page look like?  Mockup would be greatly appreciated.   Ultimately, I'll end up using django but for now I'm hopeful I could bypass django
0
Comment
Question by:forums_mp
  • 2
3 Comments
 
LVL 24

Expert Comment

by:mankowitz
ID: 39944407
If you're using jquery, the following will issue 10 nearly simultaneous requests for data.

<script>
 for (var i; i<10; i++)
    $.get( "http://www.stuff.com/xml", function( data ) {
          // do something with data
    });
</script>
0
 

Author Comment

by:forums_mp
ID: 39971002
Hate to pile on to this question ( I increased the points ), that said, the server app responds with either an image (image/jpeg) or XML (application/xml) for each GET request.   The question:   How can I check the content type and display the XML  and imagery.   Ajax and a mock up HTML page would suffice.... The XML




    "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
      "<st:testMedia>"
      "      <st:Info source=\"1\" sid=\"0939dde0-9460-4e72-b44a-a76a4395c99\">"
      "            <st:destURI>udp://225.10.10.1:15084</st:destURI>"
      "            <st:sourceStatus>Active</st:sourceStatus>"
      "      </st:Info>"
      "</st:testMedia>" ;
0
 
LVL 24

Accepted Solution

by:
mankowitz earned 150 total points
ID: 39978010
I am not sure how well jquery will parse your XML with namespaces, but something like the following would work

<div id="sourcestatus">replace contents</div>
<div id="destination">replace contents</div>

<script>
 for (var i; i<10; i++)
    $.get( "http://www.stuff.com/xml", function( data ) {
          $("#sourcestatus").html(data.sourceStatus);
          $("#destination").html(data.destURI);
    });
</script>
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
HTML CSS 7 39
insert text field data into html script 13 30
how to avoid redundand ajax calls 5 11
Add image to into animation on website template 1 11
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

28 Experts available now in Live!

Get 1:1 Help Now