javascript - $.get keeps leading to [object%20Object] -
i working quickbase database , trying pull json data via api, reason every time try get in console "400 (bad request) [object%20object]"
<!-- load handlerbars.js --> <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.rc.1/handlebars.min.js"></script> <!-- load jquery cdn easy dom manipulations --> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.0/themes/smoothness/jquery-ui.css" /> <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.0/jquery-ui.min.js"></script> <!-- simple handlebars template blog post, inside {{variable}} variables can afect js objects--> <script id="simple-template" type="text/x-handlebars-template"> <h1>{{title}}</h1> <p> {{company}} </p> </script> <script type="text/javascript"> var sgajson = https://sga.quickbase.com/db/<my-db>?apptoken=<my-app-token>&act=api_genresultstable&query={8.ex.8}&jsa=1&options=num-1; //wait page load $(document).ready(function(){ // extract text template .html() jquery helper method var raw_template = $('#simple-template').html(); // compile handlebars template var template = handlebars.compile(raw_template); // retrieve placeholder posts displayed var placeholder = $("#main"); // fetch record data server in json $.get(sgajson,function(data,status,xhr){ $.each(data,function(index,element){ // generate html each post var html = template(element); // render posts page placeholder.append(html); }); }); }); </script> </head> <body> <!-- insertion point handlebars template --> <div id="main" style="margin-left:100px"> </div>
i've seen few things this, of questions answered plugins or other method not able hoping there remedy issue i'm not seeing
it reads you're passing on wire "[object%20object]". if that's actual script, don't know how
var sgajson = https://sga.quickbase.com/db/bjyi8bgd7?apptoken=bkc8zafhy2b3qc5rdm27d5u2679&act=api_genresultstable&query={8.ex.8}&jsa=1&options=num-1;
isn't syntax error, without quotes around value. working, somehow sgajson variable being set "[object%20object]" (the result of running tostring() on object) instead of wanted.
Comments
Post a Comment