Edit Page (meaning: $this->id->CurrentValue already exist)
Call ajax and update db.
This code works.
Page_Load():
if (@$POST["myajax"] == 4 && @$POST["value1"] != "" && @$POST["value2"] != "") {
ew_Execute("update myTable set expiry='".$POST["value1"]."' where id=".$_POST["value2"]);
$this->Page_Terminate();
}
Startup Script:
$.post(ew_CurrentPage(),{ "myajax": 4, "token": EW_TOKEN, "value1": "2017-10-22 19:22:00", "value2": 4379 });
This code DON'T.
Page_Load():
if (@$POST["myajax"] == 4 && @$POST["value1"] != "") {
ew_Execute("update myTable set expiry='".$_POST["value1"]."' where id=".$this->id->CurrentValue);
$this->Page_Terminate();
}
Startup Script:
$.post(ew_CurrentPage(),{ "myajax": 4, "token": EW_TOKEN, "value1": "2017-10-22 19:22:00" });
Debug the sql, it's said:
update myTable set expiry='2017-10-22 19:22:00' where id=. // meaning: $this->id->CurrentValue is empty
Why did $this->id->CurrentValue empty in this Page_Load() server event?