JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://jquery-json.googlecode.com/files/jquery.json-2.2.min.js"></script>
JavaScript
// Module definition
// =================
// This is the Module than encapsulates the whole application
/* ----------------------------------------------------------- */
(function($, window, undefined) {
alert('dsds');
var Module = window.Module = window.Module || {};
// Namespace reference
// modules namespace
Module.Modules = {};
// pages namespace
Module.Pages = {};
// let's pretend there's code in here
console.log("Created Module");
})(jQuery, window);
// App Definition.
// -------------
(function($, window, Module) {
Module.App = (function() {
return {
userData: false,
getAuthData: function(callback) {
var params = {
successCallback: function(data) {
Module.App.userData = data;
if (callback) {
callback();
}
},
json: {
username: "osoascam",
passwordKey: "fG54hkdo94jDsnft4F",
email: "[email protected]",
phone: "78982395"
}
};
var ajax = new Module.AjaxInterface(params);
ajax.ajaxCall();
}
}
})();
})(jQuery, window, Module);
// --------------------
// This Module deals with all ajax calls
/* ----------------------------------------------------------- */
(function($, window, Module) {
Module.AjaxInterface = function(settings) {
var callback = settings.successCallback,
parameters = settings.successCallbackParameters,
sentData = settings.json,
self = this;
this.ajaxCall = function() {
$.ajax({
url: "/echo/json/",
data: {
json: $.toJSON(sentData),
delay: 1
},
type:...