1
我有一個表格,我使用jQuery的提交和無刷新頁面的工作..Symfony2中的jQuery DIV刷新不
$('#formnotifica').submit(
function(event){
event.preventDefault();
term = $(this).serialize();
url = $(this).attr('action');
$.post(
url,
term,
function(data){
}
)
}
);
現在,我只刷新我的內容的形式和提交或一些點擊後的日期第二.. 我用這個代碼時,我試過,但給我的另一頁Symfony和給我的問題..
$(document).ready(function() {
$("#aggiorna").load("");
var refreshId = setInterval(function() {
$("#aggiorna").load("" + Math.random());
}, 1000);
});
凡#aggiorna是我..我該怎麼辦的刷新「ID」我的結果在控制器中查詢?謝謝,對不起,我的英語
這是代碼的HTML
<div id="aggiorna">
<ul>
{% for n in notifications %}
{% if n.is_displayed == 0 %}
<li>
<form id="formnotifica" action="{{ path('profilo_index', {'id': n.id}) }}" method="post">
<input name="id" type="hidden" value="{{ n.id }}" />
<button class="submit" id="submit" type="submit" >{{n.text|raw}}</button>
</form>
</li>
{% else %}
<li>{{n.text|raw}}
</li>
{% endif %}
{% endfor %}
</ul>
</div>
在控制器只有DQL查詢更新一個字段在我的分貝
如果我刪除這一行,我每次刷新頁面時都會刷新.... @scoolnico –
我們可以看到en輪胎代碼? – scoolnico
是的,我把部分的html代碼感興趣@scoolnico –