Project

General

Profile

« Previous | Next » 

Revision 5783

use post() method rather than load() when the div is not given - allows calling a metacat method without replacing any content on the page

View differences:

lib/style/skins/semtools/resultset.xsl
138 138
									};
139 139
								load(
140 140
									'<xsl:value-of select="$contextURL" />/metacat', //url
141
									params, //params
142
									'<xsl:text>add_</xsl:text><xsl:value-of select="replace(./docid, '\.', '_')"/>' // div 
141
									params 
143 142
									);
144 143
								loadCart();	
145 144
							</xsl:attribute>
......
161 160
									};
162 161
								load(
163 162
									'<xsl:value-of select="$contextURL" />/metacat', //url
164
									params, //params
165
									'<xsl:text>remove_</xsl:text><xsl:value-of select="replace(./docid, '\.', '_')"/>' // div 
163
									params 
166 164
									);
167 165
								loadCart();	
168 166
							</xsl:attribute>
lib/style/common/branding.js
302 302
**/
303 303
function load(url, params, divId) {
304 304
	try {
305
		$("#" + divId).load(
306
			url, 
307
			params,
308
			// call back function when loading finishes
305
		// call back function when loading finishes
306
		var callback = 
309 307
			function(response, status, xhr) {
310
				//alert("callback for: " + divId + " selected node: " + selectedNodeId);
311 308
				// error
312 309
				if (status == "error") {
313 310
					var msg = "Sorry but there was an error: ";
314 311
					$("#error").html(msg + xhr.status + " " + xhr.statusText);
315 312
				}
316
			});
313
			};
314
		// replace div with content	
315
		if (divId) {
316
			$("#" + divId).load(
317
				url, 
318
				params,
319
				callback);
320
			} else {
321
				// just post without replacing content
322
				$.post(
323
				url, 
324
				params,
325
				callback);
326
			}	
317 327
		} catch (e) {
318 328
			// do nothing - jQuery was probably not included
319 329
		}

Also available in: Unified diff