![](/img/trans.png)
[英]How to make this javascript functions to actually gather server time and countdown until event starts instead of browser/client time?
[英]how to make interaction client server with javascript calling php functions?
我一直試圖讓多個表查看,並從該網站服務器編輯我的網站 。 我嘗試使用jquery ajax,似乎失敗還有其他方法,或者我的代碼不好嗎?
<script type="text/javascript" language="javascript">
$(document).ready(function() {
$(".setitlive").click(function() { setitlive(1); });
});
function setitlive(value1) {
var id=value1;
jQuery.ajax({
type: "POST",
url: 'C:\Users\user\Desktop\interactionclientserverwithphpandjavascript.php',
data: {functionname: 'setitlive', arguments: [id]};
}
</script>`
交互客戶端服務器PHP代碼:
<?php
header('Content-Type: application/json');
$id = $_POST['arguments'][0];
switch($_POST["functionname"]){
case 'setitlive':
public function setitlivee( $id )
{
$result = \IPS\Db::i()->update( 'cms_custom_database_26', array(
'field_113' => 'live' ), array( 'primary_id_field="'.$id.'"' ) );
header("Refresh:0");
}
break;
}
?>
HTML標頭:
<form method="POST">
button
<li class="ipsButton ipsButton_medium ipsButton_importantipsButton_fullWidth12">
<a title='{lang="accept"}' name="setitlive" id="setitlive" type="submit" onclick=" setitlive(); ">
{lang="accept"}
</a>
</li>
首先,窗口路徑不是URL。 除非您進行了瘋狂的配置,否則您的Web服務器可能不知道如何在桌面上查找文件。
將目標文件放在您的其他php文件所在的項目目錄的根目錄中,然后僅通過文件名(也可以是子目錄)來調用它。
完成此操作后,如果還有其他問題,請將其發布為新問題。
假設您的php文件都在c:\\ www中。 將該文件直接放在其中,然后...
url : 'interactionclientserverwithphpandjavascript.php',
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.