开发者

jQuery and error Internal Server Error

i have in this tow code this error: Internal Server Error

see you: http://i.stack.imgur.com/RFtvU.gif

How do I fix it?

Do you think, my code have bug, what is it?

$(".search_customer").click(function(e){
    e.preventDefault();
    var dataObj = 'customer_number='+$("#customer_number").val();
    //alert(dataObj)
    var url = $(this).attr('href');
    //alert(url);
        $.ajax({
            type: 'POST',
            dataType: 'json',
            url: url,
            data: dataObj,
            cache: false,
            success: function(data){
                //alert(data)
                if(data == 0){
                    var cssObj = {
                        'border-radius':'5px',
                        'border':'none',
                        'box-shadow': '0 0 1px 1px red',
                        'outline':'none',
                        'background':'#fafc72'
                    }
                    $('#customer_number').css(cssObj);
                    $('.search_customers, .moreinfocus_box').empty();
                    //alert('no ok')
                }else{
                    //$('.nat').show().html(data);
                    $.each(data, function (a, customer) {
                        //alert(b.name)
                        $('.moreinfocus_box').hide('slow');
                        $(this).empty();
                        $('.search_customers').html('<b>نام:</b><strong>' + customer.name + '</strong><b>شماره شناسنامه:</b><strong>' + customer.number_birth_certificate + '</strong><b>موبایل:</b><strong>' + customer.mobile + '</strong><a href="" class="moreinfo_customer" title="اطلاعات بیشتر"></a><br>').hide().fadeIn('slow');

                        $('.moreinfo_customer').live('click',function (event) {
                            event.preventDefault();                                
                            $(this).removeClass("moreinfo_customer");
                            $(this).addClass("moreinfo_customer2");
                            $('.moreinfocus_box').html('<table width="1000px"><tbody><tr><td><b>نام لاتین:</b><strong>' + customer.name_en + '</strong></td><td><b>اقامتگاه:</b><strong>' + customer.accommodation + '</strong></td><td><b>شغل:</b><strong>' + customer.job + '</strong></td><tr><td><b>نام پدر:</b><strong>' + customer.father_name + '</strong></td><td><b>ملیت:</b><strong>' + customer.nationality + '</strong></td><td><b>شماره گذرنامه:</b><strong>' + customer.passport_number + '</strong></td><tr><td><b>شماره ملی:</b><strong>' + customer.national_number + '</strong></td><td><b>تلفن:</b><strong>' + customer.phone + '</strong></td><td><b>مدت گذرنامه:</b><strong>' + customer.term_passport + '</strong></td><tr><td><b>تاریخ تولد:</b><strong>' + customer.date_of_birth + '</strong></td><td><b>همراه:</b><strong>' + customer.mobile + '</strong></td><td><b>شماره حساب:</b><strong>' + customer.account_number + '</strong></td><tr><td><b>وضعیت تاهل:</b><strong>' + customer.marital_status + '</strong></td><td><b>نمابر:</b><strong>' + customer.fax + '</strong></td><td><b>شماره کارت:</b><strong>' + customer.card_number + '</strong></td><tr><td><b>تحصیلات:</b><strong>' + customer.educati开发者_开发百科on + '</strong></td><td><b>کد پستی:</b><strong>' + customer.zip_code + '</strong></td><td><b>نام بانک و شعبه:</b><strong>' + customer.bank_name +'-'+customer.branch_name+ '</strong></td></tbody><table><tr><td><b>آدرس:</b><strong>' + customer.address + '</strong></td></table></table>').show('slow');
                        })
                        $('.moreinfo_customer2').live('click',function(event){
                            event.preventDefault();
                            $(this).removeClass("moreinfo_customer2");
                            $(this).addClass("moreinfo_customer");
                            $('.moreinfocus_box').hide('slow'); 
                        });                            
                    });
                    /*if(val == ''){
                        $(class_show + ' b').hide().remove();
                    }*/
                    //alert(data)
                }
                $('body').click(function(){
                    var cssObj = {
                        'border':'1px solid #cdcdcd',
                        'box-shadow': 'none',
                        'background':'#ffffec'
                    }
                    $('#customer_number').css(cssObj)
                    //$('#customer_number:focus').css('outline', '1px solid #93c9ff')
                })
            },
            "error": function (x, y, z) {
                // callback to run if an error occurs
                alert("An error has occured:\n" + x + "\n" + y + "\n" + z);
            }
        });
});

$('.add_customer').live('click',function(e){
        e.preventDefault();
        $('.search_customers, .moreinfocus_box').empty().html('');
        $('.moreinfocus_box').append('<form action="" method=post><table><tbody><tr><td><input name=name id="idname" placeholder="نام و نام خانوادگی" title="نام و نام خانوادگی"></td><td><input name=name_en placeholder="نام لاتین" title="نام لاتین"></td><td><input name=father_name placeholder="نام پدر" title="نام پدر"></td><td><input name=national_number placeholder="شماره ملی" title="شماره ملی"></td><td><input name=date_of_birth placeholder="تاریخ تولد" title="تاریخ تولد"></td><tr><td><input name=marital_status placeholder="وضعیت تاهل" title="وضعیت تاهل"></td><td><input name=education placeholder="تحصیلات" title="تحصیلات"></td><td><input name=accommodation placeholder="اقامتگاه" title="اقامتگاه"></td><td><input name=nationality placeholder="ملیت" title="ملیت"></td><td><input name=phone placeholder="تلفن" title="تلفن"></td><tr><td><input name=mobile placeholder="همراه" title="همراه"></td><td><input name=fax placeholder="نمابر" title="نمابر"></td><td><input name=zip_code placeholder="کد پستی" title="کد پستی"></td><td><input name=job placeholder="شغل" title="شغل"></td><td><input name=passport_number placeholder="شماره گذرنامه" title="شماره گذرنامه"></td><tr><td><input name=term_passport placeholder="مدت گذرنامه" title="مدت گذرنامه"></td><td><input name=account_number placeholder="شماره حساب" title="شماره حساب"></td><td><input name=card_number placeholder="شماره کارت" title="شماره کارت"></td><td><input name=branch_name placeholder="نام شعبه" title="نام بانک و شعبه"></td><td><input name=bank_name placeholder="نام بانک" title="نام بانک و شعبه"></td><table><tr><td><input name=address style=width:600px placeholder="آدرس" title="آدرس"></td><td style="margin: 0 500px 0 0;"><input type="submit" value="ثبت" class="wide insert_customers" style="padding: 0; margin: 0 100px 0 0;"></td></tr></table></table></form>').hide().show('slow');

    });


Internal server error is caused at the, well, server. JQuery code is client side i.e. on the browser. I would suggest that you check your backend code - code which the 'url' in the ajax request points to.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜