Subversion Repositories php-qbpwcf

Rev

Blame | Last modification | View Log | RSS feed

<?php

#使用命名空間qbpwcf
namespace qbpwcf;

#匯入外部套件
include("../../allInOne.php");

#涵式說明:
#透過javaScript傳送get數值到特定頁面,並且取得頁面的回應,將之結果放置在特定的區塊裏面。
#回傳的內容:
#$result["status"],執行正確與否,"true"代表執行正確,"false"代表執行失敗.
#$result["error"],錯誤訊息陣列.
#$result["content"],JavaScript的語法
#$result["function"],當前執行的函數名稱
#必填的參數:
$conf["javaScript::ajaxSendGetValue"]["receivePage"]="createIframe-testCase-4-2.php";#字串,要接收數值的頁面。
$conf["javaScript::ajaxSendGetValue"]["var"]=array("createIframeT4"=>"true");#陣列,要傳送的變數名稱與內容,$conf["var"]["name"]=$value,代表變數名為$name,值為$value.
$conf["javaScript::ajaxSendGetValue"]["jsFunctionName"]="createIframeT4";#字串,ajax裏面的js涵式名稱,使用該function的範例 jsFunction(this.value) ,這樣就會把表單的數值傳進去
$conf["javaScript::ajaxSendGetValue"]["responsePalaceId"]="createIframeT4";#字串,回傳的內容要呈現於哪個<span id = ? ></span>、<div id= ? ></div>區塊之間。
#參考資料來源:
#http://www.w3school.com.cn/php/php_ajax_suggest.asp
#http://www.w3schools.com/php/php_ajax_php.asp
$ajaxSendGetValue=javaScript::ajaxSendGetValue($conf["javaScript::ajaxSendGetValue"]);
unset($conf["javaScript::ajaxSendGetValue"]); 

#如果產生js語法失敗
if($ajaxSendGetValue["status"]==="false"){
        
        #印出結果
        var_dump($ajaxSendGetValue);
        
        #結束程式
        exit;
        
        }#if end
 
#印出語法 
echo $ajaxSendGetValue["content"];
 
#觸發ajax的按鈕
echo "<button onclick=createIframeT4() type=\"button\">ajax</button>"; 

#取得回饋的按鈕
echo "<div id=\"createIframeT4\"></div>"; 

?>