Commit 2e2029b3 authored by elachlan's avatar elachlan

Issue #2887225 by arunkumark, jayesh_makwana, chishah92, Sivaprasad C,...

Issue #2887225 by arunkumark, jayesh_makwana, chishah92, Sivaprasad C, elachlan: Coding Standard issues
parent 483780b9
......@@ -4,42 +4,42 @@
*/
(function ($) {
'use strict';
/**
* Attaches jQuery validate behavoir to forms.
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Attaches the outline behavior to the right context.
*/
Drupal.behaviors.CaptchaRefresh = {
/**
* Attaches jQuery validate behavoir to forms.
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Attaches the outline behavior to the right context.
*/
Drupal.behaviors.CaptchaRefresh = {
attach: function (context) {
$('.reload-captcha', context).not('.processed').bind('click', function () {
$(this).addClass('processed');
var $form = $(this).parents('form');
// Send post query for getting new captcha data.
var date = new Date();
var baseUrl = document.location.origin;
var url = baseUrl + '/' + $(this).attr('href') + '?' + date.getTime();
$.get(
url,
{},
function (response) {
if(response.status == 1) {
$('.captcha', $form).find('img').attr('src', response.data.url);
$('input[name=captcha_sid]', $form).val(response.data.sid);
$('input[name=captcha_token]', $form).val(response.data.token);
}
else {
alert(response.message);
}
},
'json'
);
return false;
});
}
};
attach: function (context) {
$('.reload-captcha', context).not('.processed').bind('click', function () {
$(this).addClass('processed');
var $form = $(this).parents('form');
// Send post query for getting new captcha data.
var date = new Date();
var baseUrl = document.location.origin;
var url = baseUrl + '/' + $(this).attr('href') + '?' + date.getTime();
$.get(
url,
{},
function (response) {
if (response.status === 1) {
$('.captcha', $form).find('img').attr('src', response.data.url);
$('input[name=captcha_sid]', $form).val(response.data.sid);
$('input[name=captcha_token]', $form).val(response.data.token);
}
else {
alert(response.message);
}
},
'json'
);
return false;
});
}
};
})(jQuery);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment