using for each of jquery am fetching td's name
but if try to test it by removing name from firbug and try to submit it then my code is breking.
so first question, what should anyone do in such case?
and another regarding my code is:

        $('#SkillDetails_table tr').each(function()
            var temp_tr_id = $(this).attr('id');    
                if(temp_tr_id.indexOf('skillDetails') !== -1)
                    var Splitted_String = temp_tr_id.split('-');
                    var validation_index=Splitted_String[1];
                        var Splitted_String = temp_tr_id.split('-');
                        var TR_ID=Splitted_String[1];                            
                            // fetch values from page
                            // HERE WHAT IF I DO NOT GET $("input[name='skillDetails[" + TR_ID + "]['skillType']']" )
                            // i.e. user has deleted it from firebug 

                            var SKILL_TYPE_NAME=$("input[name='skillDetails[" + TR_ID + "]['skillType']']" ).val().trim();
                            var SKILL_NAME=$("input[name='skillDetails[" + TR_ID + "]['skill']']" ).val().trim();

                            var PROF_LEVEL_VALUE=$('#prof_level-'+TR_ID).val().trim();
                            var EXP_YEARS_VALUE=$('#exp_year-'+TR_ID).val().trim();
                            var EXP_MONTHS_VALUE=$('#exp_months-'+TR_ID).val().trim();
                            var LAST_USED_VALUE=$('#last_used_year-'+TR_ID).val().trim();
                            var DESCIPTION_VALUE=$('#description-'+TR_ID).val().trim();

                // here i want soming like if loop that,if i did not get required values then do not go to ajax call.

                            // save values to database using ajax call
                    else{alert("no tr id got here");}
                else{//return false;
            alert("Your data has been saved in draft status.");
            alert("NOT SAVED DATA INTO DRFAT");

I know code is very worst,
but suggestions are welcome.

  1. we can't delete javascript using firbug. second if we can then here you go...
    when var SKILL_TYPE_NAME=$("input[name='skillDetails[" + TR_ID + "]['skillType']']" ).val().trim(); will be deleted the var SKILL_TYPE_NAME is undefined so check it type.

    if(typeof(var) === 'undefined'){//do stuff in case of variable line deleted using firebug.
    }else {//do normal stuff here. }

  2. To find a required value use this

    for (var k in target){if (target.hasOwnProperty(k)) {
    alert("Key is " + k + ", value is" + target[k]);}

Be a part of the DaniWeb community

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