Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8172941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T21:57:07+00:00 2026-06-06T21:57:07+00:00

I’m writing a small web app using CytoscapeWeb. It downloads an XML file containing

  • 0

I’m writing a small web app using CytoscapeWeb. It downloads an XML file containing a graph, and displays it. I’ve encountered an issue where it will not display the graph (showing instead a blank graph), even though the file is known to be sound. After several days of scouring my code to no avail, I began modifying the example code provided by the tutorial to reproduce the issue.

This code works:

function get_network(filename)
{

    var output = "";

    $.ajax({url: filename, type: "GET", dataType: "text", success: function(result) { output = result; } });

    alert(filename);
    alert(output);

    return output;

}

And this code does not:

function get_network(filename)
{ 

    var output = "";

    $.ajax({url: filename, type: "GET", dataType: "text", success: function(result) { output = result; } });

    //alert(filename);
    //alert(output);

    return output;

}

The only difference being that the two alert() statements are commented out. When only the first statement (alert(filename);) is removed, the alert box shows an empty string. So it would seem the blank graph is caused by an issue wherein the output variable is not properly set.

I’ve tested this in Firefox and Internet Explorer. It works if there is one alert statement that prints the string “ASDFSADF” rather than the output variable. Interestingly however, code that does not use the alert() statement, such as ‘var junk = “ASDFSADF”‘, does not work.

So it seems to me that there are three possibilities:

  • There is some sort of syntax or logic mistake I’ve made, which makes the number of lines parsed significant
  • Cytoscape Web is causing the issue, in a manner I cannot imagine
  • jQuery is not calling the ‘success’ function

I am beginning to suspect however that this issue is beyond my expertise, and is caused by something I have not considered.

Where that syntax error could be however is beyond me. I’ve searched high and low. Has anyone seen something like this, or otherwise know that is happening?

Thank you very much for your assistance.

The full code:
http://pastebin.com/rvcV3LFL
The XML file:
http://pastebin.com/HCyuKQnx

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T21:57:09+00:00Added an answer on June 6, 2026 at 9:57 pm

    The output variable is not set at the time of execution of the alert because the AJAX call is asynchronous (the A in AJAX is for asynchronous).

    What ever you need to happen after the AJAX call completes will need to be passed as a callback.

    So if your code is something like this:

    var graph = get_network(filename);
    draw(graph);
    

    you would need to change the get_network to:

    function get_network(filename,callback)
    { 
    
        var output = "";
    
        $.ajax({url: filename, type: "GET", dataType: "text", success: function(result) { 
    
        callback(result);
    }
    

    and the calling code would then be

    get_network(filename,draw);
    

    where draw is still the function from the first example

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We are using XSLT to translate a RIXML file to XML. Our RIXML contains
That's pretty much it. I'm using Nokogiri to scrape a web page what has
In my XML file chapters tag has more chapter tag.i need to display chapters
We're building an app, our first using Rails 3, and we're having to build
I am writing an app with both english and french support. The app requests
I'm parsing an XML file, the creators of it stuck in a bunch social
I am using Paperclip to handle profile photo uploads in my app. They upload
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.