简体   繁体   English

jQuery将参数传递给Ajax成功的函数调用

[英]jQuery pass parameters into function call from ajax success

I want to call a function when a jQuery Ajax request is successfull. 我想在jQuery Ajax请求成功时调用一个函数。 I want to pass a parameter into a second function that apparently (it doesn't work) doesn't exist inside the jquery anonymous function. 我想将参数传递给显然在jQuery匿名函数内不存在的第二个函数(不起作用)。

Here is my Ajax function: 这是我的Ajax函数:

function core_get_title(url,id_of_link){

                $.ajax({
                    type: "POST",
                    url: "url_handler.php",
                    data: { 
                        url: url,
                        cmd: "get_title",
                        },
                    success: function(data) {
                        core_title_auto(data,id_of_link);
                        }   
                });

            }

And when it calls core_title_auto, the id_of_link parameter is empty. 当调用core_title_auto时,id_of_link参数为空。

Any ideas? 有任何想法吗?

check and see whats in id_of_link before ajax call by placing an alert function 在Ajax调用之前,通过放置警报功能来检查并查看id_of_link中的内容

function core_get_title(url,id_of_link){
                alert("id_of_link"+id_of_link);  
                $.ajax({
                    /*...... your code */  
                });

            }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM