You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
//Change the link url to be a form and submit it.
|
|
|
|
//this script need jquery suport..
|
|
|
|
//url 中必须有?分开地址和参数
|
|
|
|
//this script need jQuery JavaScript Library v1.4 at least
|
|
|
|
function jsGetToPost(url, formID, target){
|
|
|
|
//
|
|
|
|
if(url.indexOf('reservation-form-tour')>0 || url.indexOf('form-citytour')>-1 || url.indexOf('form-cruise')>-1 || url.indexOf('booking-form-pay')>-1){
|
|
|
|
if(url.indexOf('http://') == 0){
|
|
|
|
url = url.replace('http://','https');
|
|
|
|
}else{
|
|
|
|
url = 'https://www.chinahighlights.com' + url;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var orgUrl = url;
|
|
|
|
url = url.split("?");
|
|
|
|
target = target?"target=\""+target+"\"":"";
|
|
|
|
var formObj = $("<form id=\"jsGetToPostForm\" method=\"POST\" action=\""+url[0]+"\" " + target + "></form>");
|
|
|
|
var addPara = formID?$("#"+formID).serialize():"";
|
|
|
|
if(addPara.length>0){
|
|
|
|
url[1] = url[1]?url[1]+"&"+addPara:addPara;
|
|
|
|
}
|
|
|
|
var paraArr = url[1].split("&");
|
|
|
|
for(var i=0;i<=paraArr.length-1;i++){
|
|
|
|
var paraKeyValue = paraArr[i].split("=");
|
|
|
|
formObj.append("<input name='"+paraKeyValue[0]+"' type='hidden' value='"+paraKeyValue[1]+"' />");
|
|
|
|
}
|
|
|
|
$("form[id=jsGetToPostForm]").remove();//Clear the form exist
|
|
|
|
formObj.appendTo("body");
|
|
|
|
setTimeout('$("#jsGetToPostForm").get(0).submit()',10);
|
|
|
|
}
|