Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/294.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何检查ajax请求是否由特定url处理_Javascript_Php_Ajax_Magento_Prototype - Fatal编程技术网

Javascript 如何检查ajax请求是否由特定url处理

Javascript 如何检查ajax请求是否由特定url处理,javascript,php,ajax,magento,prototype,Javascript,Php,Ajax,Magento,Prototype,我尝试使用ajax请求保存一个类别选项,并想知道如何检测ajax_attributes.phtml是否成功地处理了我的ajax请求。我的问题是,无论我指定什么url,它总是提醒它工作,即使我将url更改为像yadayada.phtml这样根本不存在的 new Ajax.Request('ajax_attributes.phtml', { parameters: {categoryId: categoryId},

我尝试使用ajax请求保存一个类别选项,并想知道如何检测ajax_attributes.phtml是否成功地处理了我的ajax请求。我的问题是,无论我指定什么url,它总是提醒它工作,即使我将url更改为像yadayada.phtml这样根本不存在的

 new Ajax.Request('ajax_attributes.phtml', 
            {
                parameters: {categoryId: categoryId},
                onSuccess: function(response) {
                // Handle the response content...
                alert('it works');
                },

                onFailure: function(){
                 alert('Something went wrong...');
                }
            }); 

您可以尝试使用以下代码:

var request = $.ajax({
     url: "script.php",
     type: "POST",
     data: { categoryId: categoryId},  
     dataType: "html"
}); 

request.done(function( msg ) {
     alert('it work');
});

request.fail(function( jqXHR, textStatus ) {  
     alert('Something went wrong...');
}); 

是jquery吗?我需要原型机而不是原型机是的,对不起,这是jQuery,我总是用它,我发现它更好。