From 90dc19c748194e0df9bce9b1cf176b0351e3ef07 Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Wed, 14 Aug 2013 01:55:01 +0200 Subject: [PATCH] Add functionality for loading window contents via AJAX --- public_html/static/js/jsde.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/public_html/static/js/jsde.js b/public_html/static/js/jsde.js index 275337e..acf86e8 100755 --- a/public_html/static/js/jsde.js +++ b/public_html/static/js/jsde.js @@ -54,6 +54,34 @@ function JsdeWindow(options) this.SetContents(options.contents); } + /* TODO: Documentation */ + if(typeof options.source_url !== "undefined") + { + if(typeof options.source_method !== "undefined") + { + var source_method = options.source_method; + } + else + { + var source_method = "GET"; + } + + this.loading = true; + + var container = this; + + $.ajax({ + type: source_method, + url: options.source_url, + success: function(response){ + container.SetContents(response.contents); + container.loading = false; + }, + data: options.source_data, + dataType: "json" + }); + } + if(typeof options.x === "undefined") { this.x = 0; } if(typeof options.y === "undefined") { this.y = 0; } if(typeof options.width === "undefined") { this.width = 250; }