I've created an xml file, called "pages.xml" that contains the size and position of various windows that
I want to open at various times:
pages.xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<popups>
<sw1">
<height> 300 </height>
<width> 400 </width>
<top> 50 </top>
<left> 30 </left>
</sw1>
<sw2">
<height> 600 </height>
<width> 500 </width>
<top> 80 </top>
<left> 40 </left>
</sw2>
<sw3>
<height> 700 </height>
<width> 400 </width>
<top> 130 </top>
<left> 76 </left>
</sw3>
<sw4>
<height> 850 </height>
<width> 900 </width>
<top> 100 </top>
<left> 35 </left>
</sw4>
</popups>
I'd like to use jQuery next to pull out the values that are needed by the window open code:
function open_sw2() {
window.resizeTo('600', '500');
window.moveTo('30', '80');
window.location.href = "sw2.html";
}
So above, the 600, 800, 30, and 80 came, somehow, from the sw2 entry in the xml file.
I can see that the way to bring the xml file data into the browser is probably something like
$.get('pages.xml', function() {
});
but it's not clear what the best way is then to get the parameters from the file and plug into into the open_sw2 call.
Any suggestions would be most appreciated.
Thanks.