• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Using Ajax on Pages causing issues!

Quiver

Active member
#1
I am trying to use this:

Code:
<script type='text/javascript'>
            //<![CDATA[
            function clearInput(e) {
                if (e.cleared) { return; }
                e.cleared = true;
                e.value = '';
                e.style.color = '#000';
            }
            $(window).load(function(){
                var runningRequest = false;
                var request;
                function fetch (q) {
                    if(q.length < 2){
                        $('div#pagerank').html('');
                        return false;
                    }
 
                    $('div#pagerank').html('loading...');
 
                    //Aborting running requests improves performance
                    if(runningRequest){
                        request.abort();
                    }
 
                    runningRequest=true;
                    request = $.post('',{
                        q:q
                    },function(data){
                        if (data) {
                            style = 'width:'+data*10+'%';
                        } else {
                            data='N/A';
                            style = 'background: #ccc';
                        }
                        $('div#pagerank').html('<div style="'+style+'">'+data+'</div>');
                        runningRequest=false;
                    });
                };
                /*if ($('input#q').val() <1) {
                              //prompt user to type
                      } else {
                              fetch($('input#q').val());
                      }*/
                $('input#q').keyup(function(e){
                    e.preventDefault();
                    fetch($(this).val());
                });
                $('form').submit(function(e){
                    e.preventDefault();
                });
            });
            //]]>
        </script>
It's the JavaScript part of the script which works over AJAX.
The script works but instead of loading what I want it loads a blank white page with my PublicityClerks ad in the top left corner of the screen. It appears to be conflicting with something. My guess is, AJAX on pages just doesn't work. Am I right or wrong? How can I get it to work?

We're talking something like this: http://pagerank.deaduseful.com/