Hi everybody,
what can i missing my code

jquery click function display only error function alert msg.

plz help me.

function changePage(page)
{
    $("#criteria_page").val(page);
    $("#search_new_friend").click();
}

function inviteToMypeople(personalId)
{
    if (confirm("Are you sure you want to invite " + full_name + " to your layer?")) {
        $.ajax({
            url: $("#url_invite_to_layer").val(),
            data: "personalId="+personalId,
            dataType: "json",
            success: function(xhr) {
                $("#span-add-" + personalId).html("<font color='green'>[Invited]</font> <a onclick='cancelInviteToMypeople(\"" + personalId + "\", \"" + alias + "\");'><font color='red'>[Cancel]</font></a>");
            },
            error: function(xhr) {
                alert ("Ooops... something has gone wrong when we try to invite " + alias + " to your layer.");
            }
        });
    }
}

function cancelInviteToMypeople(personalId, alias)
{
    if (confirm("Are you sure you want to cancel your invitation to " + alias + "?")) {
        $.ajax({
            url: $("#url_cancel_invite_to_layer").val(),
            data: "personalId="+personalId,
            dataType: "json",
            success: function(xhr) {
                $("#span-add-" + personalId).html("<a onclick='inviteToMypeople(\"" + personalId + "\", \"" + alias + "\")'>[add to layer]</a>");
            },
            error: function(xhr) {
                alert ("Ooops... something has gone wrong when we try to cancel your invitation to " + alias + ".");
            }
        });
    }
}

function acceptInvitationToMypeople(personalId, alias)
{
    if (confirm("Are you sure you want to accept " + alias + "'s invitation?")) {
        $.ajax({
            url: $("#url_accept_invitation_to_mypeople").val(),
            data: "personalId="+personalId,
            dataType: "json",
            success: function(xhr) {
                $("#span-add-" + personalId).html("<font color='green'>" + alias + " is now in your layer.</font>");
            },
            error: function(xhr) {
                alert ("Ooops... something has gone wrong when we try to accept " + alias + "'s invitation.");
            }
        });
    }
}

function rejectInvitationToMypeople(personalId, alias)
{
    if (confirm("Are you sure you want to reject " + alias + "'s invitation?")) {
        $.ajax({
            url: $("#url_reject_invitation_to_layer").val(),
            data: "personalId="+personalId,
            dataType: "json",
            success: function(xhr) {
                $("#span-add-" + personalId).html("<a onclick='inviteToMypeople(\"" + personalId + "\", \"" + alias + "\");'>[add to layer]</a>");
            },
            error: function(xhr) {
                alert ("Ooops... something has gone wrong when we try to reject " + alias + "'s invitation.");
            }
        });
    }
}

$(document).ready(function(){

    $("#match_other").focus(function() {
        $("#criteria_match_other").click();
    });

    $("#search_new_friend").click(function() {

        var personal, html, total_page, total_result, i,
             birth_date_print, occupation_print, education_print,  location_print,
            about_me_print, invite_print;
        var result_per_page = $("#criteria_result_per_page").val();
        var page = $("#criteria_page").val();
        var match = $("input[@name=criteria[match]]:checked").val();

        $.ajax({
            url: $("#url_search_new_people").val(),
            data: "criteria[age_min]="+$("#criteria_age_min").val()+
                  "&criteria[age_max]="+$("#criteria_age_max").val()+
                  "&criteria[sex]="+$("#criteria_sex").val()+
                  "&criteria[relationship_status]="+$("#criteria_relationship_status").val()+
                  "&criteria[country_id]="+$("#criteria_country_id").val()+
                  "&criteria[zone_id]="+$("#criteria_zone_id").val()+
                  "&criteria[match]="+$("input[@name=criteria[match]]:checked").val()+
                  "&criteria[match_other]="+$("#match_other").val()+
                  "&criteria[page]="+$("#criteria_page").val()+
                  "&criteria[result_per_page]="+$("#criteria_result_per_page").val(),

            dataType: "json",
            success: function(personals) {

                html = "";
                total_result = personals["total_result"];
                total_page = Math.ceil(total_result / result_per_page);

                delete personals["total_result"];

                if (total_result != 0) {
                    var counter = 0;

                    html += total_result;
                    if (total_result == 1) html += " People Found<br />";
                    else html += " Peoples Found<br />";
                    if (total_page > 1) {
                        // we need to redesign the paging
                        html += "Page: ";
                        for (i=1; i<=total_page; i++) {
                            if (i == page) html += "<b>" + i + "</b>";
                            else html += "<a onClick='changePage(\"" + i + "\")'>" + i + "</a>";
                            html += " ";
                        }
                        html += "<br />";
                    }

                    // any change, to be synced with personal/noticationSuccess.php - INVITATION NOTIFICATION
                   for (key in personals) {
                        counter++;
                         birth_date_print = ""; occupation_print = ""; education_print = "";
                         location_print = ""; about_me_print = "";
                        personal = personals[key];
                        if (personal["alias"]) alias_print = "My alias is " + personal["alias"] + "<br />";
                        if (($("#criteria_age_min").val() || $("#criteria_age_max").val()) && personal["birth_date_reformat"]) birth_date_print = "I was born on " + personal["birth_date_reformat"] + "<br />";
                        if ((match == "occupation" || match == "other") && personal["occupation"]) occupation_print = "I am working as a " + personal["occupation"] + "<br />";
                        if ((match == "education" || match == "other") && personal["education"]) education_print = "I study at " + personal["education"] + "<br />";

                        if ($("#criteria_zone_id").val() && personal["zone_name"]) location_print = personal["zone_name"] + ", ";
                        if ($("#criteria_country_id").val() && personal["country_name"]) location_print = "I'm now residing in " + location_print + personal["country_name"] + "<br />";
                        if (match == "other" && personal["about_me"]) about_me_print = '<i>"' + personal["about_me"].replace(/(\r\n|\r|\n)/g,'<br />') + '"</i><br /><br />';
                        if (personal["is_invites_personal"] == "1") {
                            invite_print = "<span id='span-add-" + personal["id"] + "'>" +
                                                personal["full_name"] + " invites you to the layer<br />" +
                                                "<a onclick='acceptInvitationTomypeople(\"" + personal["id"] + "\", \"" + personal["alias"] + "\");'><font color='green'>[Yes]</font></a> <a onclick='rejectInvitationToLayer(\"" + personal["id"] + "\", \"" + personal["alias"] + "\");'><font color='red'>[No]</font></a>" +
                                           "</span><br />";
                        }
                        else if (personal["is_invited_by_personal"] == "1") {
                            invite_print = "<span id='span-add-" + personal["id"] + "'>" +
                                               "<font color='green'>[Invited]</font> <a onclick='cancelInviteTomypeople(\"" + personal["id"] + "\", \"" + personal["alias"] + "\");'><font color='red'>[Cancel]</font></a>" +
                                           "</span><br />";
                        }
                        else {
                            invite_print = "<span id='span-add-" + personal["id"] + "'><a onclick='inviteTomypeople(\"" + personal["id"] + "\", \"" + personal["alias"] + "\");'>[add to layer]</a></span><br />";
                        }
                        html += 
                            "<div id='new-people-result-" + counter + "' class='border-top'>" +
                                "<a href='" + $("#url_personal_homepage").val() + "?personal_id=" + personal["id"] + "'>" +
                                    "<img src='" + $("#url_personal_image_display").val().replace(/PRIMARY_ALBUM_ID/g, personal["primary_album_id"]).replace(/ALIAS_PICTURE/g, personal["alias_picture"]) + "' alt='Picture " + personal["alias"] + "' class='new-people-picture' />" +
                                "</a>" +
                                "<div id='new-people-detail-" + counter + "' class='new-people-detail float-left'>" +

                                    birth_date_print +
                                    occupation_print +
                                    education_print +

                                    location_print +
                                    "<br />" +
                                    about_me_print +
                                    invite_print +
                                    "<a onclick='return alert(\"send message - under construction\");'>[send message]</a>" +
                                "</div>" +
                                "<div class='clear-both'></div>" +
                            "</div>"
                            ;
                    }
                }
                else {
                    html += $("#notice_new_people_no_one_match").val();
                }

              $("#new-people-found").html(html);

            },
            error: function(xhr) {
                alert ("Ooops... something has gone wrong when we try to find new people.");
            }
        });        

    });

});

Basically the server is responding with an ERROR that is why every request you did alerts an error message. Check your url in your AJAX call, are you really going to use the value of the input? Why not put the url on some data attribute

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.