原型ajax.request到jquery

时间:2013-09-24 10:02:36

标签: javascript jquery ajax prototype

我正在研究一个原型到jquery项目。我需要将此函数底部的原型ajax请求转换为jquery等效。

function formSubmit(url, options) { 
    $('#productform').action = url;
    var defaultOptions = {timeout: 300000, onSuccess : updateCallback, onFailure: failure, evalScripts: true};
    for (i in options) {defaultOptions[i] = options[i]}
    $('#productform').request(defaultOptions);
}

上述函数由以下函数调用:

function updateMain() {
    $('#Product_introduction').val(tinyMCE.get('Product_introduction').getContent());
    var string = $('#Product_introduction').val().replace(/\n/g,'');
    string = string.replace(/<script.*<\/script>/ig,'');
    string = string.replace(/<[^>]*>/ig, '');
    if(string.length > 110){
        ajax.displayMessage(t('Introduction is too long. It could be only 110 characters long. Please edit it.'), false);
    }
    if( $('#productId').val() == '' ) {
        formSubmit('/' + getControllerName() + '/create', {onSuccess: createCallback, onFailure: failureCallback});
    } else {
        formSubmit(getUpdateUrl('update'), {onSuccess: updateMainCallback, onFailure: failureCallback});
    }
}

如果需要更多信息,请与我们联系。任何帮助将不胜感激。

0 个答案:

没有答案