The XAP project has created several xModify processors (jQuery, Prototype, MooTools and XAP) to handle the execution of xModify operations. Included in the XAP core functionality is the ability to execute xModify scripts against either the HTML or UI DOMs.
xModify provides a lot of flexibility and power to dynamicaly change the HTML DOM, but can sometimes be more than is needed.
HTML blending is simpler way to do modify the HTML DOM. Each processor has a blend function that executes a request then based
on the "selector" and "mode" parameters will blend in the HTML returned from the request.
"Selectors" - refer to the underlying selector functionality of the library.
"Mode" can be "replace", "insert-after", "insert-before", "replace-children", "append"
You will need to include the latest jQuery library (Download) and the xModify extension.
<script language="JavaScript" type="text/javascript" src="javascript/jquery/jquery-latest.js"></script> <script language="JavaScript" type="text/javascript" src="javascript/xmodify/xmodify-jquery.js"></script>
Call the xModify function from JavaScript, once called the xModify processor uses the jQuery.ajax function to request the url and then process the response. You will need to typically send information to the server-side resource using a POST or GET. To do this append the parameters to the end of the url string, for example: {url:'login.jsp?username='+usernameValue+'password='+passwordValue});
$.xmodify({url:'xModify-Document.xml'});
The operations will hand off the "select" attribute to the $(select-attribute-value).
var selector = "#myDiv"; var mode = "append"; //append, replace, replace-children, insert-before, insert-after $.blend({ url: "blend.html", complete: function(results, request){ //function will be called after the xmodify //processing is finished } }, selector, mode);
<script language="JavaScript" type="text/javascript" src="javascript/xmodify/xapcore-min.js"></script> <script> var myApp = null; //When the windows on load function is called //create the XAP application. Keep a reference //to the application. window.onload = function(){ myApp = Xap.createApplication({ configFilePath:'javascript/xap/XapConfig-Min.js', element:null }); } </script>
Call the xModify function from JavaScript, once called the xModify processor uses the XAP underyling communication functionality to request the url and then process the response.
myApp.fireEvent('xModify-Document.xml');
<script language="JavaScript" type="text/javascript" src="javascript/jquery/mootools-latest.js"></script> <script language="JavaScript" type="text/javascript" src="javascript/xmodify/xmodify-mootools.js"></script>
Call the xModify function from JavaScript, once called the xModify processor uses the XHR object to request the url and then process the response. You will need to typically send information to the server-side resource using a POST or GET. To do this append the parameters to the end of the url string, for example: 'login.jsp?username='+usernameValue+'password='+passwordValue};
var myXhr = new XHR({ async: true, method: "get", onSuccess: function(){ } }); var result = myXhr.xmodify("statements/mootools/"+macroName+".xml");
The operations will hand off the "select" attribute to the $(select-attribute-value).
var selector = "#myDiv"; var mode = "append"; //append, replace, replace-children, insert-before, insert-after var myXhr = new XHR( { async: true, method: "get", onSuccess: function(){ } } ); var result = myXhr.blend("blend.html", selector, mode);
<script language="JavaScript" type="text/javascript" src="javascript/jquery/prototype-latest.js"></script> <script language="JavaScript" type="text/javascript" src="javascript/xmodify/xmodify-prototype.js"></script>
Call the xModify function from JavaScript, once called the xModify processor uses the Ajax object to request the url and then process the response. You will need to typically send information to the server-side resource using a POST or GET. To do this append the parameters to the end of the url string, for example: 'login.jsp?username='+usernameValue+'password='+passwordValue};
new Ajax.xmodify("statements/prototype/"+macroName+".xml");
The operations will hand off the "select" attribute to the $(select-attribute-value).
var selector = "#myDiv"; var mode = "append"; //append, replace, replace-children, insert-before, insert-after new Ajax.blend("blend.html", selector, mode);