Ajax - How refresh <DIV> after submit

Posted by user107712 on Stack Overflow See other posts from Stack Overflow or by user107712
Published on 2009-05-15T14:09:20Z Indexed on 2010/04/16 21:43 UTC
Read the original article Hit count: 390

Filed under:
|
|
|

Hi,

How refresh part of page ("DIV") after my application release a submit? I'm use JQuery with plugin ajaxForm. I set my target with "divResult", but the page repeat your content inside the "divResult". Sources:


$(document).ready(function() {
$("#formSearch").submit(function() {
var options = {
target:"#divResult", url: "http://localhost:8081/sniper/estabelecimento/pesquisar.action"
}
$(this).ajaxSubmit(options);
return false;
});
})

Page
...

...

             <div id="divResult" class="quadro_conteudo" >      
                 <table id="tableResult" class="tablesorter">      
                     <thead>      
                         <tr>      
                             <th style="text-align:center;">      
                                 <input id="checkTodos" type="checkbox" title="Marca/Desmarcar todos" />      
                             </th>      
                             <th scope="col">Name</th>      
                             <th scope="col">Phone</th>      
                         </tr>      
                     </thead>      

                     <tbody>      
                         <s:iterator value="entityList">      
                             <s:url id="urlEditar" action="editar"><s:param name="id" value="%{id}"/></s:url>      
                            <tr>      
                                <td style="text-align:center;"><s:checkbox id="checkSelecionado" name="selecionados" theme="simple" fieldValue="%{id}"></s:checkbox></td>      
                                <td> <s:a href="%{urlEditar}"><s:property value="name"/></s:a></td>      
                                <td> <s:a href="%{urlEditar}"><s:property value="phone"/></s:a></td>      
                            </tr>      
                         </s:iterator>      
                     </tbody>      
                 </table>      

                 <div id="pager" class="pager">      
                     <form>      
                         <img src="<%=request.getContextPath()%>/plugins/jquery/tablesorter/addons/pager/icons/first.png" class="first"/>      
                         <img src="<%=request.getContextPath()%>/plugins/jquery/tablesorter/addons/pager/icons/prev.png" class="prev"/>      
                         <input type="text" class="pagedisplay"/>      
                         <img src="<%=request.getContextPath()%>/plugins/jquery/tablesorter/addons/pager/icons/next.png" class="next"/>      
                         <img src="<%=request.getContextPath()%>/plugins/jquery/tablesorter/addons/pager/icons/last.png" class="last"/>      
                         <select class="pagesize">      
                             <option selected="selected" value="10">10</option>      
                             <option value="20">20</option>      
                             <option value="30">30</option>      
                             <option value="40">40</option>      
                             <option value="<s:property value="totalRegistros"/>">todos</option>      
                         </select>      
                         <s:label>Total de registros: <s:property value="totalRegistros"/></s:label>      
                     </form>      
                 </div>      
                 <br/>      
         </div>

Thanks!!!

© Stack Overflow or respective owner

Related posts about AJAX

Related posts about jQuery