麻烦写PHP变量转换为JavaScript [英] Trouble writing php variables into javascript

查看:79
本文介绍了麻烦写PHP变量转换为JavaScript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 'success'=>'js: function(data) {
        $("#addToListDialog$model->product_id").dialog().dialog("close");}'

我想上面写的一块的JavaScript,但不能为了解决PHP变量大括号单/双引号的正确组合。我应该怎么写呢?

I'm trying to write the above piece of javascript, but can't get the right combination of curly brackets a single/double quotes in order to resolve the PHP variable. How should I be writing this?

推荐答案

一个更清洁的方式:

'success'=>'js: function(data) {
        $("#addToListDialog'.$model->product_id.'").dialog().dialog("close");}'

这篇关于麻烦写PHP变量转换为JavaScript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆