asp.net mvc - Javascript Get URL is giving an error 404 -


i get http:/.../url 404 (not found) when trying url javascript. error seems come $.get("url").done in script.

do see wrong code ? can't figure out. hint.

 @model tp1webstore3.viewmodels.shoppingcartviewmodel   @{    viewbag.title = "shopping cart";  }  <script src="/scripts/jquery-1.8.2.min.js" type="text/javascript"></script>   <script type="text/javascript">      $(function () {          $('.removelink').click(function () {              $.ajax({                  url: '/panier/removefromcart',                  data: { id: $(this).data('id') },                  type: 'post',                  cache: false,                  success: function (result) {                     $('#row-' + result.deleteid).fadeout('slow');                     $('#cart-status').text('cart (' + result.cartcount + ')');                     $('#update-message').text(result.message);                     $('#cart-total').text(result.carttotal);                     $.get("url").done( function(data){ $("#tablecontent").html(data); } ); <==                  },                                                                        error                  error: function(xmlhttprequest, textstatus, errorthrown) {                   alert("status: " + textstatus); alert("error: " + errorthrown);               });              return false;          });      });  </script>  <h3>     <em>details</em> du panier:  </h3>  <p class="button">      @html.actionlink("checkout >>", "addressandpayment", "checkout")  </p>    <div id="update-message">  </div>  <div id="table-content">   @html.partial("tablecontent") </div> 

tablecontent.cshtml partial view

@model tp1webstore3.viewmodels.shoppingcartviewmodel

 <a href="#" class="tablecontent">      <table>          <tr>              <th>                  produit              </th>              <th>                 prix (unitaire)              </th>              <th>                  quantite              </th>              <th></th>          </tr>          @foreach (var item in model.cartitems)          {              <tr id="row-@item.produitid">                  <td>                      @html.actionlink(item.produit.description, "details", "produit", new { id =                          item.produitid }, null)                  </td>                  <td>                      @item.produit.prix                  </td>                  <td id="item-count-@item.panierid">                      @item.quantite                  </td>                  <td>                      <a href="#" class="removelink" data-id="@item.panierid"> enlever du panier                      </a>                  </td>              </tr>          }          <tr>              <td>                  total              </td>              <td></td>              <td></td>                <td id="cart-total">                   @model.carttotal                </td>          </tr>      </table>  </a> 

on line

$.get("url").done( function(data){...} 

it seems you're trying use variable named url containst url you're supposed use. instead, you're harcoding "url" causes get url http:\\yourbaseurl\url wrong.

can't sure seems you're trying

$.get(url).done( function(data){...} 

where url defined someplace above.


Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -