You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by iv...@apache.org on 2010/08/27 08:47:22 UTC

svn commit: r990043 - /wicket/trunk/wicket/src/main/java/org/apache/wicket/ajax/wicket-ajax.js

Author: ivaynberg
Date: Fri Aug 27 06:47:21 2010
New Revision: 990043

URL: http://svn.apache.org/viewvc?rev=990043&view=rev
Log:

Issue: WICKET-2958

Modified:
    wicket/trunk/wicket/src/main/java/org/apache/wicket/ajax/wicket-ajax.js

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/ajax/wicket-ajax.js
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/ajax/wicket-ajax.js?rev=990043&r1=990042&r2=990043&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/ajax/wicket-ajax.js (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/ajax/wicket-ajax.js Fri Aug 27 06:47:21 2010
@@ -776,13 +776,14 @@ Wicket.Ajax.Request = Wicket.Class.creat
 
 Wicket.Ajax.Request.prototype = {
     // Creates a new request object.
-	initialize: function(url, loadedCallback, parseResponse, randomURL, failureHandler, channel) {
+	initialize: function(url, loadedCallback, parseResponse, randomURL, failureHandler, channel, successHandler) {
 		this.url = url;
 		this.loadedCallback = loadedCallback;
 		// whether we should give the loadedCallback parsed response (DOM tree) or the raw string
 		this.parseResponse = parseResponse != null ? parseResponse : true; 
 		this.randomURL = randomURL != null ? randomURL : true;
 		this.failureHandler = failureHandler != null ? failureHandler : function() { };
+		this.successHandler = successHandler != null ? successHandler : function() { };
 		this.async = true;
 		this.channel = channel;
 		this.precondition = function() { return true; } // allow a condition to block request 
@@ -942,6 +943,7 @@ Wicket.Ajax.Request.prototype = {
 					// In case the page isn't really redirected. For example say the redirect is to an octet-stream.
 					// A file download popup will appear but the page in the browser won't change.					
 					this.done();
+					this.successHandler();
 					
                     // support/check for non-relative redirectUrl like as provided and needed in a portlet context
 					if (redirectUrl.charAt(0)==('/')||redirectUrl.match("^http://")=="http://"||redirectUrl.match("^https://")=="https://") {
@@ -1032,7 +1034,7 @@ Wicket.Ajax.Call.prototype = {
 
 		var c = channel != null ? channel : "0|s"; // set the default channel if not specified
 		// initialize the internal Ajax request
-		this.request = new Wicket.Ajax.Request(url, this.loadedCallback.bind(this), true, true, failureHandler, c);
+		this.request = new Wicket.Ajax.Request(url, this.loadedCallback.bind(this), true, true, failureHandler, c, successHandler);
 		this.request.suppressDone = true;
 	},