我在下面有一个代码,通过从上传图片的文件夹中读取图片名称来显示图片名称。
I have a code below, which display image name on UI by reading it from the folder where those images are uploaded,
这些图片名称使用 java脚本模板,我想将该名称传递给php函数,以检查其状态
These image names are displaying using a java-script template, I want to pass that name to a php function in order to check its status by hitting the db by the image name..
以下是图片名称在UI中的显示方式:
Here is how the image name is displaying in UI:
<!-- The template to display files available for download --> <script id="template-download" type="text/x-tmpl"> {% for (var i=0, file; file=o.files[i]; i++) { %} <tr class="template-download fade"> <td> <span>{%=file.name%}</span> <!----- new update --------> var a= file.name; $.ajax({ type: "POST", url: "localhost/tripvioapp/trips/showStatus/", dataType: "text", data: {image_name: a,trip_id: '2'}, success: function(msg){ alert(msg);//how can i display this value in this place } }); </td> </tr> {% } %} </script>基本上,我已经集成了使用Codeigniter进行文件上传(php框架)从本教程
Basically, i have integrated file upload with Codeigniter(php framework) From this tutorial
到目前为止我尝试了
{%= file.name%} 如下
$this->tripmodel->getImageStatusByUidName('\"{%=file.title%}\"',"2"); //calling php function结果:
预期(因为它应该工作)
$this->tripmodel->getImageStatusByUidName("imageName.jpg","2");任何人都可以帮我解决这个问题吗?
Can anyone help me with this,please?
推荐答案你应该把php代码放在之类的
you should put php code betwee somthing like
<?php $this->tripmodel->getImageStatusByUidName( "{%=file.name%}","2"); ?>使用它。我没有测试它
更多推荐
如何从java脚本模板传递php参数
发布评论