jQuery handle null value in PHP variable or array

Handling php array or variable inside javascript directly using json_encode, will result some value null.
To check null using jquery in this case:

	parse php multidimensional array
	var operators = $.parseJSON('<?php echo json_encode($operators);?>');
	//example check for null
	if( operator[0].last_name !== null ){
		lastName = operator.last_name;
	}

By Keenlio, August 6, 2014

What do you think?

Leave a Reply

Your email address will not be published. Required fields are marked *


7 − four =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>