-1

I want to pass data from jsp file to droplet using ajax.

function myNotification(productId,skuId,product) {
     if (confirm('Are you sure?')) { 
     $.ajax({
            type : "POST",
            url : "merchant_popup.jsp",
            data : {
                productId:""+productId+"",
                skuId : "" + skuId + "",
                product : "" + product + "",

            },
            success : function(result) {
                if(result.trim() == "OK"){
                    alert("Email send successfully");
                } else {
                    alert("Error");
                }
            }//
        });

     }else{
     }
 }

Then I use below droplet to catch data within merchant_popup.jsp

merchant_popup.jsp

            <dsp:droplet name="EmailNotification">
                <dsp:param name="productId" param="productId" />
                <dsp:param name="skuId" param="skuId" />                    
                <dsp:param name="product" param="product" />

            </dsp:droplet>

But function is not success. Can any one help me.

enter image description here

Lankani
  • 1
  • 3

1 Answers1

0

If merchant_popup.jsp is in same folder , and dsp:import for the droplet mentioned is available ..Path Of/EmailNotification. Try adding some dummy statement with dsp:valueof for param::

enter code here

See if these values are going till JSP or not.

I believe there might be three possibilities. I am not sure where you are stuck.

  1. The way you are posting value. Try below way.

data : {  
              "productId" : productId,
              "skuId" : skuId,
              "product" : product,
               },
  1. Droplet is not imported or properly not imported (path of component).
  2. If values are passing and in droplet you are able to get the passed data then, Please check the droplet response. are you really setting correctly response.redirect, or checkRedirect parameters in droplet with "OK" as string.
  3. If third one is not correctly done then should give you some value.

Try above step by step. to avoid turn around time work directly on .jsp in .ear file in development mode.

Thanks, hope it helps..!! Cheers..!!

CodeGeek
  • 1
  • 2