简体   繁体   中英

This jQuery code is working great on Mozilla, but not on Chrome, Opera, Safari

I am giving here two code. First code is working great on all browsers. And my second code is working only on Mozilla not on Chrome, Opera, or Safari.

This code is working on all browsers correctly:

function load_more(_param)
{
    jQuery($.post( "ajax_return_data.php",{ type: "comments", ids: _param.id },
                function(xhr) {

                // Code to process response
                //alert(xhr.rows_0);

            loading_content(xhr,_param.id);
                },'json'
            ));
}

This is my second code, which works great on Mozilla but not working on Chrome, Safari, Opera. I don't think there is any big difference between both code. My second function is created by first but don't know why it's not working on all browsers.

function create_a_like(_param = 'NULL', type)
{

        jQuery($.post( "ajax_like_post_comment.php",{ type: type, ids: _param },
                function(xhr) {

                // Code to process response
                //alert(xhr.rows_0);
                alert(xhr[0]);
            //completing_create_a_like(xhr);
                },'json'
            ));
}

OMG, i Can't believe this can be a problem. After posting question here , i had match both code and find 1 difference. i was remove default value & it worked well. Then i searched and find this.

function Foo(arg1, arg2) {
    if (typeof(arg1) === "undefined") { arg1 = 50; }
    if (typeof(arg2) === "undefined") { arg2 = "default"; }
}

JavaScript have different mechanism for define default value of function aurgment

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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