i want to use the value of a php variable within a jquery ajax function. i however first need to test if the variable has value.
i know that i can test the length of a object like this:
if ($(selector).length)
i am not sure how i can test if a jquery variable has value. below is my test;
$idAjax = 15;
<script>
jQuery(document).ready(function(){
function ajaxMessagesCount(){
var theData = <?php echo $idAjax ?>;
if (theData.length){
//do somting
}
})
</script>