【发布时间】:2011-12-18 17:48:32
【问题描述】:
$event = $fieldset->addField('parent_id', 'select', array(
'label' => Mage::helper('gallery')->__('Parent'),
'required' => true,
'name'=>'parent_id',
'values'=>$ac,
'onchange'=>'CheckSelectedItem()',
));
$event->setAfterElementHtml('<script>
function CheckSelectedItem()
{
var ddllist= window.document.getElementById("parent_id");
var itemName= ddllist.options[ddllist.selectedIndex].value;
如何在 form.php 上为位于名为“gallerydata.php”的根文件夹中的文件进行 ajax 调用。 我有一个名为“画廊”的扩展,用于从后端上传图像。所以我想通过使用调用该文件“gallerydata.php”的ajax从下拉列表中获取艺术家的ID。
if(window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
xmlhttp1=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp1=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
alert(xmlhttp.responseText);
}
}
xmlhttp.open("GET","http://122.170.97.189:81/electriccityusa/gallerydata.php?q="+itemName,true);
}
</script>');
【问题讨论】:
-
为什么不用Prototype Javascript框架的Ajax APO?
-
不清楚这里问的是什么。
-
我的问题是“如何在magento上以adminhtml形式使用ajax????”
标签: ajax magento call adminhtml