开发者

How do I know this function is return empty..and how do I show it?

I am not familiar with javascripts...so cant understand how do I check which variable return empty?? if tweet is there then it fill with tweets but if not then it wont show up. but I want know which varible is fills the container and if I want show "there is no tweets for you" then where will I add that??

$(document).ready(function() {
    $.twtter.start({
        searchType:"searchWord", 
        searchObject:"google", 
        lang:"en", 
        live:"live-180", 
        placeHolder:"twitterdiv", 
        loadMSG: "Loading messages...", 
        imgName: "loader.gif", 
        total: 6, 
        readMore: "Read it on Twitter", 
        nameUser:"image", 
        openExternalLinks:"newWindow", 

    });
    $("#twitSearch").submi开发者_C百科t(function(){

        $.twtter.start({

            searchType:"searchWord",

            searchObject:$(".twitSearch").val(),
            live:"live-180", 

        });
                return false;

    });


})

the result is displayed in

<div id="twitterdiv"></div>

THanks


No, Javascript is client side PHP is server side. There is a massive conceptual chasm between the two.

Server Side Vs. Client Side


Warning Stupid answer ahead

JavaScript

window.location = 'script.php?test=' + myVar;

PHP

echo (empty($_GET['test'])) ? 'empty' : 'not empty';

This should be ringing warning bells.

You can not use PHP to check if a JavaScript variable is empty, at least not in a way that doesn't make you (or others) say WTF.

What you probably want is a different way to do it. You can send all JavaScript variables to a PHP script, and then validate them in the PHP. Post more code please.

Or if you just want to do it inside of JavaScript, you can do it like this (if it is a string)

if (myVar === '') {
   alert('empty');
}

or if you'd rather have an empty function like the PHP language construct, go with

function empty(str) {
    return (str === '');
}


You can not check whether or not a javascript variable is empty with php. If you could post your code, we could get to your problem better.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜