小编Bri*_*lot的帖子

从数据属性中替换最后一个破折号值?

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)

javascript jquery

3
推荐指数
1
解决办法
74
查看次数

如何检查该元素是否存在于 Cakephp 3 中?

检查 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)

谢谢 :)

php cakephp

0
推荐指数
1
解决办法
1535
查看次数

标签 统计

cakephp ×1

javascript ×1

jquery ×1

php ×1