php - when there is no data found set null -
I am using jquery to get value from php scripts and keep them in between tags. But sometimes nothing is sent as value. Then I would like to show words nonsense. Is it the right thing to do for an empty variable? It depends, if the totaaluernproject is null or undefined , If it is zero then there is no need to check it, just print the value and it is zero, other intelligent if it can be undefined, you can do this: This will give you results in both cases with a more controlled state $ Ajax ({type: "POST", url: "Relations / Relations Report" data: { "Clent" Clint, "project" project, "Van" Van, "Baby" tot}, datatype: 'json "error: function () {alert (" Onvoldoende gegevens beschikbaar om rapportage to genereren. ");}, success: function (data) {// Plaats data op de juiste Plek D table var = data in titel. Titel; Projektid = Detakprojektid; Kansolklog (Projektid); $ Kpost ( "Rpportge / Rpport_ditel" {Projektid: "Projektid"}); Projektype = Detakprojektype, Projektlandr = Detakprojektlandr, Projektype = data. Projecttype, statusproject = data.statusproject, startproject = data.startproject, deadlineproj ect = data.deadlineproject, omzetproject = data.omzetproject, kostenproject = data.kostenproject, totaalurenproject = data.totaalurenproject, totaalminutenproject = data. totaalminutenproject, urenkostenproject = data.urenkostenproject; to var str = ''; (var i = 0; Lane = titel.length; I & lt; lane; i ++) {str + = "& lt; tr;" + "to
totaalurenproject [I] = totaalurenproject [i] || "zero"; str + = "& Lt; Td & gt; + + Totaalurenproject [i] + ":" + totaalurenproject [i];
Comments
Post a Comment