Hi Maender,
All is fine now, i can select product. but i think i'm not able to consume the web template because my alert does not come up.
my code
$(document).ready(function () {
$("#ics_product").change(function () {
var prodname=$(ics_product_name).val();
var orderid = getQueryStringByName('id');
var url = '/getproductprice/?product='+prodname;
$.ajax({
type: "GET",
url: url,
dataType: 'json',
async: false,
}).done(function (json) {
if(json>0){
var test=json.unit;
alert(test);
}
});
});
});
function getQueryStringByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
// my web temp
{%fetchxml query%}
<fetch version="1.0" output-format="xml-platform" returntotalrecordcount="true" mapping="logical" distinct="false">
<entity name="ics_productmaster">
<attribute name="ics_productmasterid" />
<attribute name="ics_productcode" />
<attribute name="ics_mrp" />
<attribute name="createdon" />
<order attribute="ics_productcode" descending="false" />
<filter type="and">
<condition attribute="ics_productcode" operator="eq" value="{{request.params['product']}}" />
</filter>
</entity>
</fetch>
{%endfetchxml%}
{
{% for result in query.results.entities %}
"value":[{
"count": "{{ query.results.total_record_count }}" ,
"unit": "{{result.ics_mrp}}"
}]
{% unless forloop.last%},{%endunless%}
{%endfor%}
}