At the least, the syntax of the parameters you are passing to connection.request is wrong. Specifically, the signature is:
request( requestObject, callback)
Where both requestObject and callback are objects. You are passing a single object with three properties that mix properties from requestObject and callback. Plus the property names for the callback methods are wrong.
The default connection for an App is a Presto Connect for JavaScript connection object. You can find detailed API information for this at http://www.jackbe.com/prestodocs/v3.0/presto-apis/pc4js/symbols/Presto.Connection.html. (API reference docs are available for all the public Presto APIs at http://www.jackbe.com/prestodocs/v3.0/presto-apis/presto-apis-intro.html.)
If you look at the sample code in http://www.jackbe.com/prestodocs/v3.0/apps-dev/createSimpleGrid.html, the full call to connection.request is:
connection.request(
{
url: "/presto/edge/api/rest/YahooLocalSearchREST/getData?x-presto-resultFormat=json&appid=.kcC72DV34FYTpAGuwwbV8YGI.DsMBQ0RB9eZARS621ecnHq33c.g1XJV93a64hrdaM3&query=banks&zip=94102&results=20",
type: "get",
contentType: "application/x-www-form-urlencoded",
data: requestBody
},
{ onSuccess: function(response, responseHeaders) {
var result = response;
if (result.ResultSet.Result) {
var locations = result.ResultSet.Result;
jQuery.tmpl("rowTemplate", locations).appendTo(".tblBdy");
} else {
rootDiv.html("no results found");
}
},
onFailure: function(e) {
}
}); First object has four properties, not just a URL. Second object has two properties, one for each of the callback methods, onSuccess and onFailure.
Sara, technical writer/jackbe
Thanks Sara. With your help, and scoping out the Javascript API documentation, I was able to resolve my issues. I had to switch my vCloud API and it worked perfectly! I admit, I confused myself by the end of the day! Here is the solution:
Sample.SampleGrid = function( app ) { var rootDiv = jQuery(app.getRootElement); var myTbl = rootDiv.find('.flintclass'); var connection = app.getConnection(); var requestBody = ''; myTbl.html('mindsv1'); document.getElementById('flintdiv').innerHTML = 'fredflintstone'; myTbl.append('appendingv1'); var rowMarkup = "<tr><td>${lasttrade}</td></tr>" jQuery.template("rowTemplate",rowMarkup); connection.request({ url: "http://localhost:8080/presto/edge/api/rest/Yahoo_Finance_Stock_Quote_1/runMashup?x-presto-resultFormat=json", type: "get", contentType: "application/x-www-form-urlencoded", data: requestBody }, { onSuccess: function (response,responseHeaders) { var result = response; if (result.stockquote) { var locations = result.stockquote; jQuery.tmpl("rowTemplate", locations).appendTo(".tblBdy"); document.getElementById('flintdiv').innerHTML = "last trade:" + locations.lasttrade; } }, onFailure: function (a) { document.getElementById('flintdiv').innerHTML = a; } }); };



Hi All,
I've been a jackbe user for about a week. I'm having trouble getting a response back from the Presto service when attempting to complete the tutorial here: www.jackbe.com/prestodocs/v3.0/apps-dev/createSimpleGrid.html.
Here is the javascript in my app. Again, it is as if the connection.request command isn't even firing. For test, I placed my javascript into an aspx page, and got a json response back from JackBe. So, I know the code is valid, and that presto is listening. Yes, my code differs from that of the tutorial, and I did this in attempts to isolate the issue. I have confirmed that everything up to 'connection.request'... is functioning well. Thanks in advance.
Sample.SampleGrid = function( app ) {
var rootDiv = jQuery(app.getRootElement);
var myTbl = rootDiv.find('.flintclass');
var connection = app.getConnection();
myTbl.html('jumpover');
document.getElementById('flintdiv').innerHTML = 'fredflintstone';
myTbl.append('appendingv1');
connection.request({
url: "http://localhost:8080/presto/edge/api/rest/Yahoo_Finance_Stock_Quote_1/runMashup?x-presto-resultFormat=json",
success: function (data) {
document.getElementById('flintdiv').innerHTML = data;
},
error: function (e, t, a) {
document.getElementById('flintdiv').innerHTML = a;
}
});
};