0

Ok, I have a Highcharts.js page that currently loads its data from making an api call that contains a query of the database. My issue is that the query needs to be able to have user input in order for them to be able to get the graph of what they are looking for (in this case it would be an input of a station ID

The HTML

  <!-- Page Content -->
    <div id="page-content-wrapper">
        <div class="container-fluid">
            <div class="row">
                <div class="col-lg-12">
                    <h1>Sidebar</h1>
                    <div id="container" class="resize" style=" width: 100%; height: 100%; margin: 0 auto "></div>
                    <a href="#menu-toggle" class="btn btn-default" id="menu-toggle">Toggle Menu</a>
        <input type="text" id="q" />
        <input type="button" id="submit" value="submit" />
                </div>
            </div>
        </div>
    </div>
    <!-- /#page-content-wrapper -->


$(function () {
    $('#submit').click(function() {
    sgaxml = 'https://sga.quickbase.com/db/bjmdensiu?apptoken=beadyrucxguavbx5isubd6iaqpe&act=API_DoQuery&query={14.EX.';
    sgaxml += $('#q').val();
    sgaxml += '}&clist=7.24.25.26.27.28.29.30.31.32.33.34.35.36.37';
    console.log(sgaxml); } 
};

At one point using this I was able to confirm that it was making the input the url, but I couldn't it to work as a variable for the charts call

$.get(sgaxml, function(xml) {

    // Split the lines
var xml = $(xml).find('record');

Also, sgaxml is declared (var sgaxml = '') globally.

I have tried it a few different ways and can't decide if I am going completely the wrong direction for what I am trying to do or if I am just making it more complicated than it needs to be. I left out my chart data as the data itself for the chart works (when it's fed information), but if you would like to see the whole thing I will comment it.

  • not really sure what you are trying to solve for, im seeing output into the console that looks like what i think you would be expecting. Am i just completely missing something? I think what i am missing is what you are trying to do as the next step – workabyte Feb 24 '15 at 16:19
  • Well, once the URL is done, it's supposed to use that url as the API call to get the data from the database and load it into a chart, but unfortunately once it puts the url together nothing happens as far as the chart – ALearningExperince Feb 24 '15 at 21:25
  • Are there any errors when inspecting the page? what you have posted seems sound but there is likely something else that could be causing the issue – workabyte Feb 25 '15 at 17:04
  • 1
    I actually ended up figuring this out after I got home last night and felt completely face-palm moment, but when I called the Highcharts.js, I was doing so before jquery was ever there, so it didn't work, but for some reason was not returning anything about it in the console (errors usually happen saying undefined). Once I moved the jquery first, it worked just as intended – ALearningExperince Feb 25 '15 at 19:24

1 Answers1

0

This is not an answer, just a long comment.

Are you aware of cross-domain scripting issues?

What is JSONP all about?

Cross Domain Scripting Issues & JSONP


Are you familiar with AJAX? You are using $.get(), which is a short form of $.ajax(), so probably you are. But just in case:

A simple example

More complicated example

Populate dropdown 2 based on selection in dropdown 1

Community
  • 1
  • 1
cssyphus
  • 37,875
  • 18
  • 96
  • 111