var dataUrl = $('#AjaxMoreStatus').attr("data-url");
// http://localhost:8888/app/status/get/31/7
Run Code Online (Sandbox Code Playgroud)
我需要将最后一个破折号(7)的链接的最后一个值更改为另一个值.7是动态值.
我可以做到吗?
例如,如果我想将动态值7改为9:
var new = 9;
$("#AjaxMoreStatus").attr("data-url", url without the 7 + '/' + new);
Run Code Online (Sandbox Code Playgroud) 检查 cakephp 3 中是否存在一个元素,一个 .ctp 文件的最佳方法是什么?
像这样的东西,
<?php
// if the elemet exist display it
$this->render('/Element/Trip/'.$current_step);
// else display another element instead
?>
Run Code Online (Sandbox Code Playgroud)
谢谢 :)