Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Re : ajax call to database example

$
0
0
Almost...

You need to return the Deferred that $.ajax gives you. Not sure what the d property of the response Deferred is meant to be in your code.

While technically right, there are a few things you may want to consider:

1) Your client side code should not need to know what table to look things up in. You can specify a type that your server maps to a table name or since you are hitting the /recipes URL, you know already that the type of thing requested is a recipe.

2) You should use proper HTTP verbs for your Ajax calls. findAll should use GET instead of POST.

Viewing all articles
Browse latest Browse all 3491

Trending Articles