title: ModelAndView not rending via JQuery
body: <p>I am trying to render ModelAndView from an AJAX call. The hit goes to the controller and it is returning ModelAndView. However, when I try to render that object via $(#div).html(response), it simply displays a blank page. I used $(#div).text(response) to check if I am receiving HTML response and I do. The HTML response I am receiving is of the whole page and not just the DIV fragment I am returning in ModelAndView. I am completely confused since I have used this approach sucessfully in different project. Below are the code snippet:</p>
  
  <p><strong>Javascript file>>></strong></p>
  
  <pre><code>    $.ajax({
      type: "GET",
      url: contextPath + "/order/orderMiscDetails/"+orderNo,
      success: function(response) {
          $("#divPayment").empty();
          $('#divPayment').html(response);
          //ajaxCallEnd();
      }
  });
  </code></pre>
  
  <p><strong>Controller Code>>>></strong></p>
  
  <pre><code>    @RequestMapping(value = "order/orderMiscDetails/{orderNo}",method=RequestMethod.GET)
  public ModelAndView orderMiscDetails(@PathVariable("orderNo") String orderNoStr, 
          Model model) throws Exception {
  
      Long orderNo = 0l;
  
      System.out.println("Called&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;orderMiscDetails&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;");
  
      CustomerOrder customerOrder = new CustomerOrder();
      customerOrder.setOrderNumber(orderNo);
      customerOrder = orderAdminService
              .getCustomerOrderByOrderNo(customerOrder);
  
  
      Map&lt;String,Object&gt; modelMap = new HashMap&lt;String, Object&gt;();
      modelMap.put("customerOrder", customerOrder);
      ModelAndView mv= new ModelAndView("order/payment_history",modelMap);
      System.out.println(mv.toString());
  
      return mv;
  }
  </code></pre>
  
  <p><strong>DIV Fragment JSP>>>></strong></p>
  
  <pre><code>&lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%&gt;
  </code></pre>
  
  
  
  <pre><code>            &lt;div class="heading"&gt;PAYMENT HISTORY&lt;/div&gt;
              &lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;
                  &lt;tr&gt;
                      &lt;th width="30"&gt;S.No.&lt;/th&gt;
                      &lt;th&gt;Transaction Date&lt;/th&gt;
                      &lt;th align="right" style="text-align: right;"&gt;Transaction
                          Amount&lt;/th&gt;
                      &lt;th&gt;Transaction Type&lt;/th&gt;
                      &lt;th&gt;Transaction ID&lt;/th&gt;
                      &lt;th&gt;MATransaction ID&lt;/th&gt;
                      &lt;th&gt;Reason&lt;/th&gt;
                      &lt;!-- &lt;th width="100"&gt;Action&lt;/th&gt;--&gt;             
                          &lt;/tr&gt;
                  &lt;c:forEach items="${customerOrder.orderTransactions}"
                      var="orderTransaction" varStatus="loopStatus"&gt;
                      &lt;%-- &lt;c:if test="${orderTransaction.orderTransactionStatus eq '0'}"&gt;  --%&gt;  
  
                      &lt;tr id='transaction_${orderTransaction.ordertransactionID}'&gt;
                          &lt;td&gt;${loopStatus.index+1}&lt;/td&gt;
                          &lt;td&gt;${orderTransaction.date}&lt;/td&gt;
                          &lt;td align="right"&gt;
                              ${customerOrder.landing_page_id.currencies.currencies_symbol} ${orderTransaction.transactionAmt}
                          &lt;/td&gt;
                          &lt;td&gt;${orderTransaction.transactionType}&lt;/td&gt;
                          &lt;td&gt;${orderTransaction.transactionID}&lt;/td&gt;
  
                          &lt;td&gt;&lt;c:if test="${empty orderTransaction.mATransactionID}"&gt;N/A&lt;/c:if&gt;${orderTransaction.mATransactionID}&lt;/td&gt;
                          &lt;td&gt;${orderTransaction.reason}&lt;/td&gt;
                          &lt;%-- &lt;input type="hidden" id="param1" value="${orderTransaction.ordertransactionID}"/&gt; --%&gt;
                       &lt;!--   &lt;td&gt;&lt;a onClick=deleteOrderTransaction();&gt;Delete&lt;/a&gt;&lt;/td&gt; --&gt;
                      &lt;/tr&gt;
                  &lt;%--  &lt;/c:if&gt;  --%&gt;
                  &lt;/c:forEach&gt;
              &lt;/table&gt;
  </code></pre>
  
  <p>Can there be something wrong with Spring settings?</p>
  
  <p><strong>SOLUTION:</strong></p>
  
  <p>I was able to solve this. However, the solution is very weird and I have no idea how is it working!</p>
  
  <p>For some reason, jquery's .html() is not working. It worked when I replaced
  $('#divPayment').html(response);
  by
  document.getElementById('divPayment').innerHTML = response;</p>
  
  <p>JQuery is included properly since I am using throughout the same JSP. Whatever it is, thanks everyone!</p>