rahul chaurasia
rahul chaurasia

Reputation: 153

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'
            ));
}

Upvotes: 1

Views: 215

Answers (1)

rahul chaurasia
rahul chaurasia

Reputation: 153

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

Upvotes: 1

Related Questions