Greetings @KK Sir and to @All!
I am trying to access a repeatable region for performing an AJAX call. I am able to access a repeatable dropdown but for changing its CSS but not for the AJAX call.
This is what I have:
1. Repeatable Region:
2. A DBF with the bound field:
3. AJAX:
4. quotation-ajax.php:
Now if i try to access the dropdown using the following jQuery it works:
and the dropdown background changes to YELLOW.
But if i use the above ajax jquery (as in #3) it does not work at all. What can be the issue!
Regards,
GenXCoders
I am trying to access a repeatable region for performing an AJAX call. I am able to access a repeatable dropdown but for changing its CSS but not for the AJAX call.
This is what I have:
1. Repeatable Region:
- Code: Select all
<cms:repeatable name="item_detail" label="Item Detail" order="10" >
<cms:editable name="product" label="Product" type="dropdown" opt_values="Select =- | <cms:pages masterpage='product/product.php' order='asc' orderby='product_name'><cms:show product_name /><cms:if '<cms:not k_paginated_bottom />'>|</cms:if></cms:pages>" order="1" />
<cms:editable name="product_hsn" label="HSN" type="text" order="2" />
</cms:repeatable>
2. A DBF with the bound field:
- Code: Select all
<div class="col-md-12">
<cms:input name="item_detail" type="bound" onchange="myfunction()" />
<div class="gxcpl-ptop-20"></div>
</div>
3. AJAX:
- Code: Select all
<script type="text/javascript">
$('td div select').change(function() {
var data = "";
$.ajax({
type:"GET",
url : "<cms:show k_site_link />generate/quotation-ajax.php",
data: {
select_id:$(this).val()
},
async: false,
success : function(data) {
console.log(data);
},
error: function (xhr, status, err) {
alert(err);
}
});
});
</script>
4. quotation-ajax.php:
- Code: Select all
<?php require_once('../couch/cms.php'); ?>
<cms:set selected_product="<cms:gpc 'select_id' method='get' />" scope="global" />
<cms:pages masterpage='product/product.php' id=selected_product>
<cms:set selected_product_id="<cms:show k_page_id />" scope="global" />
</cms:pages>
<cms:content_type 'application/json'/>
<cms:template title="Quotation AJAX" hidden='1' parent="_generate_" />
<cms:pages masterpage='product/product.php' id=selected_product_id>
{
"product_hsn": "<cms:addslashes><cms:show product_hsn/></cms:addslashes>"
}
<cms:if "<cms:not k_paginated_bottom/>">,</cms:if>
</cms:pages>
<?php COUCH::invoke(); ?>
Now if i try to access the dropdown using the following jQuery it works:
- Code: Select all
<script>
$('td div select').css( "backgroundColor", "yellow" );
</script>
and the dropdown background changes to YELLOW.
But if i use the above ajax jquery (as in #3) it does not work at all. What can be the issue!
Regards,
GenXCoders