Magento custom jquery ajax not working in server but working in live -


hi new magneto have created separate module duplicate product through jquery ajax while click individual product product have been duplicating in local while in server side not working shows below error.

http://example.com/advert_live/index.php/helloworld/index/ 503 (service unavailable) 

the ajax showing above error , while using simple echo code jquery ajax working in server while putting code duplicating product ajax shows 503 error. below duplicating product code. can please me solve issue.

<?php require_once 'app/mage.php';  umask(0); mage::app(‘default’); class magentotutorial_helloworld_indexcontroller extends mage_core_controller_front_action {             public function indexaction() {          $final = $_post['value'];         $obj = mage::getmodel('catalog/product');         $_product = $obj->load($final);          $newproduct = $_product->duplicate();         $newproduct->setstatus(1);         $newproduct->setsku('value'.$final);         $newproduct->getresource()->save($newproduct);      }  } 

i have called jquery ajax below ajax code

  <script>                         var jq = jquery.noconflict();                         jq(document).ready(function(){                             jq(".adv_listing_duplicate" ).on( "click", function() {                                 var id= this.id;                             var uniqu_number = id.split("_");                              var unique  = uniqu_number[3];  jq.ajax({             type: "post",             datatype: "text",             data :{'value':unique},             url :"<?php echo $this->geturl('helloworld/index',array('_secure'=>true)); ?>",             success:function(data1){                  alert('your product have been duplicated succesfully');                },     error: function (request, status, error) {         alert(request.responsetext);},          });          });           }); </script> 


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -