The file I was editing was...
/cookbook/models/recipe.js
The page I was using was...
/cookbook/recipe/list/views/list.html
I thought recipe.js was the correct place to put the ajax call for findAll. Does that sound right?
I put the original code back in place to make sure I didn't corrupt anything.
I tried console.log on a brand new page to catch the server data (see below ===).
The server sends a string
return '{
"data": [
{ "name" : "soup", "description" : "hearty" },
{ "name" : "beer", "description" : "tasty" }
],
"count" : 2
}';
Console log displays [object Object]
================================================
function GetDataFromServer() {
var vars = "{ paramz : 'nada' }";
return $.ajax({
type: "POST",
url: "/WebService1.asmx/recipes",
data: vars,
contentType: "application/json; charset=utf-8",
dataType: "json"
});
}
function testo() {
var data = GetDataFromServer();
console.log(data);
}
// a button click fires testo()
================================================
/cookbook/models/recipe.js
The page I was using was...
/cookbook/recipe/list/views/list.html
I thought recipe.js was the correct place to put the ajax call for findAll. Does that sound right?
I put the original code back in place to make sure I didn't corrupt anything.
I tried console.log on a brand new page to catch the server data (see below ===).
The server sends a string
return '{
"data": [
{ "name" : "soup", "description" : "hearty" },
{ "name" : "beer", "description" : "tasty" }
],
"count" : 2
}';
Console log displays [object Object]
================================================
function GetDataFromServer() {
var vars = "{ paramz : 'nada' }";
return $.ajax({
type: "POST",
url: "/WebService1.asmx/recipes",
data: vars,
contentType: "application/json; charset=utf-8",
dataType: "json"
});
}
function testo() {
var data = GetDataFromServer();
console.log(data);
}
// a button click fires testo()
================================================