samedi 2 juillet 2016

Comparison of two String is not working in script

Actually in my function I have to compare two strings, the one string I fetch through the db and compare to the null string but it's not working.. Here is my Code:

   order.items.forEach(function(entry) {
                            result += '<tr>' 
                                      + '<td>'+'<font size=2>'+ a++ + '</font>'+ '</td>'
                                      + '<td>' +'<font size=2>'+ entry.title + '</font>'+ '</td>'
                                      + '<td>' +'<font size=2>'+ entry.quantity + '</font>'+'</td>'        
                                    if(entry.personalization == 'null')     //here is the problem                                                       
                                      + '<td>' +'<font size=2>'+ 'No Personalization' + '</font>'+'</td>'
                                    else
                                      + '<td>' +'<font size=2>'+ entry.personalization + '</font>'+'</td>'                                          


                                    + '</tr>';
                        })

                     result +='</table>';

$('.modal-body').html(result);

Aucun commentaire:

Enregistrer un commentaire