based on the query string, I include a portion of a different code SSI in the footer page. My query string for example:
?headId=520&genderType=2
?headId=600&genderType=1
function GetQueryStringParams(sParam){
var sPageURL = window.location.search.substring(1);
var sURLVariables = sPageURL.split('&');
for (var i = 0; i < sURLVariables.length; i++) {
var sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] == sParam) {
return sParameterName[1];
}
}
}
$(document).ready(function() {
var genderM = GetQueryStringParams('genderType');
var genderF = GetQueryStringParams('genderType');
if ( genderM == 2 ) {
$('#adv').html('<!--#include virtual="genderM.shtml"-->')
} else if (genderF == 1 ){
$('#adv').html('<!--#include virtual="genderF.shtml"-->')
};
});
Can someone help me?
Thanks!!
You can just put the SSI inside an html page eg anotherpage.html
<!--#include virtual="genderM.shtml"-->
Then load the page using javascript:
$.ajax({
url: "anotherpage.html",
success: function(data) {
$('#adv').html(data);
},
dataType: 'html'
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.