从jQuery的symfony的2目录加载PHP文件加载、文件、目录、jQuery

2023-09-10 19:25:45 作者:心酸i

我有这行code(jQuery的)在树枝文件包内(BundleDir /包/视图/ MAPNAME / index.html.twig):

I have this line of code (jQuery) in a twig file inside a bundle( BundleDir/Bundle/views/mapname/index.html.twig) :

$('#datacount').load('getDataCount.php');

我的问题是我在哪里需要把getDataCount.php文件中symfony的2目录。 它口口声声说,这个文件不能被发现。

my question is where do i need to put getDataCount.php file in the symfony 2 directory. It keeps saying that this file can't be found..

谢谢!

推荐答案

jQuery.load()执行HTTP GET请求,在你的情况下,它是越来越getDataCount.php。

jQuery.load() performs an HTTP GET request, in your case it's GETting 'getDataCount.php'.

要么你真的(真的,真的),希望该文件到独立,并且你可以把一个/,然后将该文件在您的Web文件夹

Either you really (really, really) want that file to standalone, and you can just put a "/" and move the file in your web folder

$('#datacount').load('/getDataCount.php');

app/..
src/..
web/getDataCount.php

或你希望它是一个symfony的控制器,并在书的 http://symfony.com/doc/current/book/routing.html

干杯

 
精彩推荐
图片推荐