admin管理员组

文章数量:1305577

I am getting this error on the error console and can't seem to figure it out, I tried taking out the quotes, moving them around but still can't solve the error which is : missing name after . operator. How can this error be fixed?

var counter = 0;
counter++;
    
result = '<span class="imagemsg'+counter+'">The file was uploaded successfully!</span><br/><br/>'; 

...

jQuery.ajax("deleteimage.php?imagefilename=" + image_file_name)
    .done(function(data) {
        $(".imagemsg".counter).html(data);
    });

I am getting this error on the error console and can't seem to figure it out, I tried taking out the quotes, moving them around but still can't solve the error which is : missing name after . operator. How can this error be fixed?

var counter = 0;
counter++;
    
result = '<span class="imagemsg'+counter+'">The file was uploaded successfully!</span><br/><br/>'; 

...

jQuery.ajax("deleteimage.php?imagefilename=" + image_file_name)
    .done(function(data) {
        $(".imagemsg".counter).html(data);
    });
Share Improve this question edited Jul 31, 2021 at 22:43 xXx 1,1611 gold badge11 silver badges24 bronze badges asked May 2, 2012 at 12:25 user1359453user1359453 751 silver badge7 bronze badges 1
  • It looks like you're confusing Javascript and PHP syntax. Is there any reason you're preceding a Javascript variable name with $? It is valid, but I think it's much less mon, unless it has some specific meaning. – Travesty3 Commented May 2, 2012 at 12:36
Add a ment  | 

1 Answer 1

Reset to default 8

Use + to concatenate strings, not ., which means addressing object's property in JavaScript and, understandably, requires a property name.

本文标签: javascriptmissing name afteroperator error needs fixingStack Overflow