-
Notifications
You must be signed in to change notification settings - Fork 14
Use jQuery params to create URL strings. #24
Copy link
Copy link
Open
Description
jQuery allows you to encode objects into url strings very easily and it's clean.
This will improve readability.
For example in quiz.js the URL generation is ugly.
function linkToQuizFromJSON(url) {
return url.attr("protocol") + "://" + url.attr("host") + url.attr("directory") + "quiz.html" +
"?seed" + seed.toString(16) +
"&jsonString" + url.param("numQuestions") +
extraParams;
}
wouldn't it be better to write
var params = { 'seed' : seed,
'numQuestions' : numQuestions,
...
};
var str = jQuery.param( params );
https://foo.cs.ucsb.edu/seriousjs/index.php/JQuery:URL_Parameters
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels