kimjoar / writings Goto Github PK
View Code? Open in Web Editor NEWMy blog posts
My blog posts
var search = $("#username").val();
$.ajax({
url: 'https://coderwall.com/' + search + '.json?callback=?',
dataType: "json",
timeout: 5000,
success: function (data) {
$.each(data, function (key, val) {
var username = val.username;
var name = val.name;
var location = val.location;
var github = val.accounts.github;
$('#result').append('<h1>' + name + '</h1>');
$('#result').append('<h2>' + location + '</h2>');
$('#result').append('<p>Github account: <a href=https://github.com/' + github + ' target=_blank>' + github + '</a></p>');
$.each(val.badges, function (key2, val2) {
var badge_name = val2.name;
var badge_desp = val2.description;
var badge_img = val2.badge;
$('#bimg').append('<li class="bassdge"><figure><img src=' + badge_img + '/><figcaption><p id=despt >' + badge_desp + '</p><b class=name>' + badge_name + '</b></figcaption></figure></li>');
});
});
},
error: function (data) {
alert('Username does not found');
}
});
EDIT:
this is worked out - the server/node part was confusing, and by the time the example code was compensated for a traditional setup vs. the js server, your code examples were changed and i was missing the point/benefits of the exercise.
now it's just throwing the response back in an echo and the example code stays in tact.
nice work - thank you.
-------original message below:------
don't have express installed.
wanted to follow along.
do you have instructions for setting up in localhost/wamp (w/o node)?
thanks for making this post/app.
In this stage: https://github.com/kjbekkelund/writings/blob/master/published/understanding-backbone.md#lets-use-a-model
Following code:
var Statuses = function() {};
Statuses.prototype.add = function(text) {
var status = new Status();
// DOCS: http://documentcloud.github.io/backbone/#Model-save
status.save({text : text}, {
success: function(model, data) {
console.log("success callback");
events.trigger('status:add', data.text);
},
error : function(model, xhr, options) {
console.log("error callback");
console.log(model);
console.log(xhr);
console.log(options);
}
});
};
Causes error callback to be called, not really sure why... Here is the full source: https://gist.github.com/stefek99/ccdb3dd2e40e5e656805
I know that this is just a step in a tutorial and probably can be skipped however I would really like to know why it isn't working at this stage.
Thanks for help in support, great piece of writing BTW :)
In this example, doing html generation via JS seems ok because there is so little of it, but in a larger project, something like mustache (or even the _ template) becomes much more necessary. It might be worth making use of templates in the this tutorial.
Hello,
I have read with great interest your article, and Backbone is a lot clearer for me, thanks !
I was testing the code when it occured to me that the final code is not the complete mirror of the Jquery/AJAX version, as the backbone version uses the model text variable, while the former uses what comes from the server. (I found out when my server crashed and the content was still displayed.)
Am I correct or have I misunderstood something ?
Thanks you,
Nathan
at around "We do the same with NewStatusView:" in step-by-step-modules.md this line in the following code block
, 'modules/status/newStatusView'
should be green, or?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.