Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>URL passing wasn't correct. It should be like that:</p> <pre><code> url: "/shop-portal/add?category_id="+catid+"&amp;product_id="+id+"&amp;quantity="+qanty, </code></pre> <p>Now I see that you have array with the same names ("catid", "quantity" ...). Do you eventually want to send the values from the array? Because this is another thing. Make sure that "catid", "id" and "qanty" are global variables and you send the desired values. </p> <p>Joomla is probably not expecting JSON data, try with native ajax request</p> <pre><code>var xmlhttp; if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest(); } else { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 &amp;&amp; xmlhttp.status==200) { alert("Sent!"); } } xmlhttp.open("GET","/shop-portal/add?category_id="+yourvariable+"&amp;product_id="+yourvariable+"&amp;quantity="+yourvariable); xmlhttp.send(); </code></pre> <p>I'm not sure what values you want to send. Take care of them (yourvariable1, yourvariable2...)</p> <p>Now I see that you want to pass values from the array. Try with </p> <pre><code> $.ajax({ type: 'GET', data:products, url: "/shop-portal/add?category_id="+products[0].catid+"&amp;product_id="+products[0].id+"&amp;quantity="+products[0].qanty, dataType: 'json', }) }) </code></pre> <p>This request will send only the values from the first product. Products is an array so you probably must loop thru it and send multiple requests in order to send everything.</p> <p>You can check what does the var "products" contain with console.log(products) .This will display the content in the console (Firebug for example).</p> <pre><code>$('.checkOut').live('click',function(){ var products= new Array(); $(".jshop_prod_cart").each(function(){ var product = new Object(); product.catid = $(this).find('[name="category_id"]').val(); product.id = $(this).find('input[name="product_id"]').val(); product.qanty = $(this).find('input[name^="quantity"]').val(); products.push(product) $.ajax({ type: 'GET', data:products, url: "/shop-portal/add?category_id="+product.catid+"&amp;product_id="+product.id+"&amp;quantity="+product.qanty, dataType: 'json', }) }) }); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload