i have a select field set that triggered AJAX script when onchange, the ajax is calling the controller with post data, but i got an error saying
loader.js:41 Uncaught TypeError: url.match is not a function
here's the code:
$k = Mage::getSingleton('core/session')->getFormKey();
$event = $fieldset->addField(
'category_id',
'select',
array(
'label' => Mage::helper('test_sellercenter')->__('Category '),
'name' => 'category',
'values' => Mage::helper('test_sellercenter/dropdown')->getLazadaCategories(),
'class' => 'required-entry lazadacat',
'onchange' => 'checkSelectedItem(this)',
'container_id' => 'categoryId'
));
$event->setAfterElementHtml("<script type=\"text/javascript\">
function checkSelectedItem(selectElement){
new Ajax.Request({
url: '".$this->getUrl('test_sellercenter/Adminhtml_MassActions/attributeslazada')."',
type: 'POST',
data: {category: selectElement.value, form_key:'".$k."'},
success: function(data) {
console.log(data);
}
});
}
</script>");