Backbone.ajax
You can use a custom AJAX function, if your endpoint do not support the jQuery.ajax API.
Example :
You can use a custom AJAX function, if your endpoint do not support the jQuery.ajax API.
Example :
<!DOCTYPE
html>
<head>
<title>Router
Extend Example</title>
<script
src="https://code.jquery.com/jquery-2.1.3.min.js"
type="text/javascript"></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.2/underscore-min.js"
type="text/javascript"></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.1.2/backbone-min.js"
type="text/javascript"></script>
</head>
<script
type="text/javascript">
Backbone.ajax({
dataType:
"jsonp",
url:
"https://mysite.com/abcd.html?id=2",
data:
"",
success:
function
(val) {
var
myModel = new
Backbone.Model
({
name:
val
});
var
myCollection = Backbone.Collection.extend({
model:
myModel
});
collection
= new
myCollection(val);
}
});
</script>
No comments:
Post a Comment