使用mootool ajax功能显示加载图像

时间:2013-07-26 08:26:59

标签: php ajax mootools

我正在使用简单的ajax功能,使用mootool显示加载图像。我在onRequest上添加了加载图片但没有工作。我的代码有什么问题。我在Uncaught SyntaxError: Unexpected token }

之后收到}).send();

我的代码:

$('nextButtonForm2').addEvent('click', function(e) {
    e.stop();
    var url = 'index.php?option=com_property&view=property&task=advertisementBox&format=raw';
    var x = new Request({
        url: url,
        method: 'post',
        onSuccess: function(responseText) {
            document.getElementById('advertisement_image').innerHTML = responseText;
        },
        onRequest: function() {
            $('advertisement_image').set('html', '<div><img src='http: 
            //www.example.com/template/xxx/xx/images/loding.gif'></div>');
            }
    }).send();
});

有任何想法或建议吗?感谢。

2 个答案:

答案 0 :(得分:1)

试试这个:

onRequest: function() {
    $('advertisement_image').set('html', '<div><img src=\"http://www.example.com/template/xxx/xx/images/loding.gif\"></div>');
}

答案 1 :(得分:0)

onRequest函数中的单引号未正确转义。尽量逃避内部引用。

相关问题