Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #233 from darkwing/querystring-next-enhancement

Cleaning up the 'next' parameter in AJAX call to prevent empty next
  • Loading branch information...
commit 62b9f90ae305e1dad9e93c6f28543f938013712a 2 parents df5df5e + d481f31
@groovecoder groovecoder authored
Showing with 12 additions and 4 deletions.
  1. +12 −4 media/js/mdn/init.js
View
16 media/js/mdn/init.js
@@ -43,9 +43,9 @@ jQuery.fn.placeholder = function(new_value) {
/* Parse a querystring into an object */
jQuery.extend({
- parseQuerystring: function(){
+ parseQuerystring: function(str){
var nvpair = {},
- qs = window.location.search.replace("?", ""),
+ qs = (str || window.location.search).replace("?", ""),
pairs = qs.split("&");
$.each(pairs, function(i, v){
@@ -143,8 +143,16 @@ jQuery.extend({
// then show the signed-out block again
$signedOutList.hide();
- $.get($signedOutList.attr('data-browserid-header-signin-html'), {
- next: $.parseQuerystring().next || window.location.pathname
+ // Retrieve the login url
+ var url = $signedOutList.attr('data-browserid-header-signin-html');
+
+ // Split the URL, find the next value
+ var urlSplit = url.split("?"),
+ rootUrl = urlSplit.shift(),
+ qstring = urlSplit.join("?");
+
+ $.get(rootUrl, {
+ next: $.parseQuerystring(qstring).next || $.parseQuerystring().next || window.location.pathname
}, function(content) {
$signedOutList.html(content).each(function() {
$('.toggle', $(this)).click(function() {
Please sign in to comment.
Something went wrong with that request. Please try again.