开发者

passing null values from ajax to phpscript

I am having some problems with null values

Is there a good way of passing the null values from js in a way that they are interpreted the same.

This apparently is not the same

aj开发者_开发知识库axNullVar = null;
post_var = {'action': 'update_foto','fotoid': fotoid, 'ajaxNullVar': ajaxNullVar };
        $.ajax({
            url: post_url,
            data: post_var, 

in php

if ($_POST['ajaxNullVar']!=NULL)$ajaxNullVar='php null is not the same as a js null';
alert($ajaxNullVar);

I tested for a while now, and setting the null values in php, does not cause a problem when posting to the api, but coming from ajax it does?? Before I start thinking about a workaround, I thought I ask here first.

thanks, Richard


if you don't pass that parameter then i think php will read it as null. i've done the following basic test:

<?php
if($_GET['a'] == null){
   echo('null');
} else{
   echo('not null');
}
?>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜