Error : expecting ] token after element when using ajax.get

I keep getting an error when i run the debugger that says "SyntaxError: missing ] after element list"

the first request always works as intended but all of the follow requests return a syntax error. can someone explain to me what i'm messing up here. please and thankyou.

$("#submitmsg").click(function(){
    alert('start');      
    var clientmsg = $("#usermsg").val();  
    $.post("post.php", {text: clientmsg});                
    $("#usermsg").attr("value", "");  
    return false;  
}); 
setInterval($.ajax({
        url : 'http:www.whatever.com/log.html',
        type : 'GET', 
            success : function(data)
            {
                document.getElementById('chatframe').innerHTML = data; 
            }
        }), 500);  

</script>

Answers


your setInterval is wrong, it should be, setInterval(func, delay[, param1, param2, ...]); like

setInterval(ajax_func, 500);

function ajax_func() {
  $.ajax({
        url : 'http://www.whatever.com/log.html',
        type : 'GET', 
        success : function(data) {
            document.getElementById('chatframe').innerHTML = data; 
        }
  });
}

Need Your Help

is it possible to run drupal 6 on mysql 5.6

php mysql apache drupal drupal-6

Currently my website is running on MySQL version 5.2 with drupal 6 and now i want to upgrade both apache server and MYSQL database.

iOS CorePlot scatter plot crashes when i load it many times

ios memory core-plot scatter-plot

I'm writing an app in which i'm trying to use a scatterplot.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.