I ran into this problem in the past and realized, it's hard to remember the eval function and without that you could end up spending a lot of time, trying to figure out passing multiple params with dynamic values. (partNumber_1, quanitty_1...partNumber_2, quantity_2).
eval() evaluates the expression in the argument. If the argument is one or more JavaScript statements, eval() executes the statements.
E.g. service code.
var renderCtx = wc.render.getContextById("AjaxAddToCartContext");
//setting context properties
renderCtx.properties['partNumber'] = partNumber;
renderCtx.properties['quantity'] = quantity;
eval("params.partNumber_" + counter + "='"+partNumber+ "';");
eval("params.quantity_" + counter + "="+quantity+ ";");
//invoke the AJAX service for orderitem add (Cart Service)
wc.service.getServiceById("AjaxAddOrderItem").formId = orderFormId;
wc.service.invoke("AjaxAddOrderItem", params);
eval() evaluates the expression in the argument. If the argument is one or more JavaScript statements, eval() executes the statements.
E.g. service code.
var renderCtx = wc.render.getContextById("AjaxAddToCartContext");
//setting context properties
renderCtx.properties['partNumber'] = partNumber;
renderCtx.properties['quantity'] = quantity;
eval("params.partNumber_" + counter + "='"+partNumber+ "';");
eval("params.quantity_" + counter + "="+quantity+ ";");
//invoke the AJAX service for orderitem add (Cart Service)
wc.service.getServiceById("AjaxAddOrderItem").formId = orderFormId;
wc.service.invoke("AjaxAddOrderItem", params);
Many individuals require the chance to acquire a little measure of money that would be accessible in their next paycheck and a few organizations will go after that.Check Cashing
ReplyDeleteThanks for sharing this such an informative and useful blog and beneficial. If anyone wants to become front end developer join the good IT company -
ReplyDeletebest Node JS development company
iPhone application development company
Enhorabuena por el artículo, muy buena redacción, se nota claramente que le pones esfuerzo y ganas.
ReplyDeleteMuy buen post, gracias por compartir esta información, sin duda seguiré esperando a que subas más contenido.
ReplyDeleteServices included keyword research, buy curated links, data pulls, and monthly link building.
ReplyDelete