Merhaba çocuklar dönmek ve ben çok aradık ancak herhangi bir çözüm alamadım bu ben parsererror hepAjax görüşmem. Her zaman hatayı ben magento çalışıyorum
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
responseText "NULL\nNULL\n{"savedRows":1...":"successfully saved"}"
status 200
statusText "OK"
bile alıyorum
var $wk_jq = jQuery.noConflict();
$wk_jq.ajax({
url : "<?php echo $this->getUrl('mpmassuploadaddons/index/runProfiler'); ?>",
type : 'GET',
data : {id : profilerId,row : countOfStartedProfiles},
dataType : 'json',
success : function(content) {
console.log('content success');
},
error: function(xhr, textStatus, errorThrown) {
console.log(xhr);
console.log(textStatus);
console.log(errorThrown);
}
});
benim ajax olan benim php kod iyi çalışıyor ve burada başarı mesajı ile json kodlamak dize {"savedRows":1,"success":"successfully saved"}
dönüyor benim php kodu
public function runProfilerAction() {
ob_start();
$profileId = $this->getRequest()->getParam('id');
$rowCount = $this->getRequest()->getParam('row');
$profile = Mage::getModel('mpmassuploadaddons/profilesession')->load($profileId);
if($profile->getproductType() == "simple") {
$result = Mage::getModel('mpmassuploadaddons/mpmassupload')->importSimpleProducts($profileId,$rowCount);
} elseif($profile->getproductType() == "downloadable") {
$result = Mage::getModel('mpmassuploadaddons/mpmassupload')->importDownloadableProducts($profileId,$rowCount);
} elseif($profile->getproductType() == "virtual") {
$result = Mage::getModel('mpmassuploadaddons/mpmassupload')->importVirtualProducts($profileId,$rowCount);
} elseif($profile->getproductType() == "configurable") {
$result = Mage::getModel('mpmassuploadaddons/mpmassupload')->importConfigurableProducts($profileId,$rowCount);
}
echo json_encode($result);
}
Bu json olan 01.233.... ben burada json_encode
Umarım çalıştığını bu
ob_clean();
önce ekle thanks
olduğunu console.log ('içerik suxccess'); suxccess ?? –
Neden ob_start() başlangıçta? İsterseniz ob_clean() yöntemini deneyebilirsiniz, ancak bu bir çözüm değildir. –
Magento kodunuz json dizenize "NULL \ nNULL \ n" yazıyor mu? –