After I run YUI Compressor, I'm getting this error:
invalid regular expression flag h
[Break On This Error] ction(event){$(this).removeClass('lumi...cs_glb.php</b> on line <b>221</b><br/>
The part of the JS code in questions is:
//Form LUMI
$('input').focus(function(event){
$(this).addClass('lumi');
});
$('input').blur(function(event){
$(this).removeClass('lumi');
});
I validated the JS code with http://www.javascriptlint.com/online_lint.php and it points no error.
Does anybody knows what's wrong?
After trying one thousand ways to debug this, I found out that a php warning was causing the error. It is hard to find this kind of error because the Firebug debugger was pointing to a totally different direction. Thanks.
Related
I'm having a trouble why I'm getting this error
and I'm following this an old source like like.It is possible that the syntax of old version is not the same that been using now programitically? It would be great if anybody could figure out, thank you so much in advance!.
There are the list of error when I clicked those error in my console
json.dart
dynamic convert(String input) => _parseJson(input, _reviver);
json.dart
if (reviver == null) return decoder.convert(source);
return JsonDecoder(reviver).convert(source);
main.dart
var datauser = json.decode(response.body);
You're first character is a <br>, so it's not a json or strong, could be a 404 error html page, which can't be parsed. Double check the URL you are pinging.
So I'm not familiar with PHP and a friend of mine got this error message from their site:
Uncaught Error: Function name must be a string in
/var/www/wp-content/themes/framework/php/class-htmlhelper.php:222
Any help on what is needed would be greatly appreciated! I've tried to understand what component needs to become a string but I'm not sure...
In line number 218 you have to write $this->element to call a function.
I think $this->$element['type'] not string.
You try print $this->$element['type']
Jquery print a syntax error when I try to interpret an AJAX response from my Apache server.
The file is printed in php with Smarty as template engine.
Here is a simple minimal working exemple of the "bug" (from the chromium javascript terminal)
> $.post('newtasklist',{name: 'hello'},function(ans){console.log($(ans))})
XHR finished loading: "http://localhost/narasimha/newtasklist". jquery-1.9.1.js:8526
Uncaught Error: Syntax error, unrecognized expression: <li><a><input type="hidden" class="listid" value="4" />hello(0)</a></li>
As you see, it's not a problem in my HTML tag. I thought it could be a BOM (I work under gedit 3.6.2), so I've bomstrip-files every .php and .tpl files of my project directory... but it hasn't changed anything.
In addition, I've add ans.replace(/^\uFEFF/, '') to my answer script, but it don't work either.
Does anyone think about another solution?
Edit:
I've tried to count the number of bytes in the answer. It tell me "75", 2 bytes more than the actual string. But I don't know the origin of this difference.
> $.post('newtasklist',{name: 'salut'},function(ans){
console.log('ans : ', ans);
console.log('n_ans : ', ans.length);})
ans :
<li><a><input type="hidden" class="listid" value="13" />salut(0)</a></li>
n_ans : 75
> '<li><a><input type="hidden" class="listid" value="13" />salut(0)</a></li>'
.length
73
I never worked with smarty, but i have some thoughts, maybe they can help you to find the problem. It looks more like a smarty/php error to me
what happens when you just open the post-url in the browser? does it show the same issue?
i don't know how sensitve smarty is... what DOCTYPE do you use... if it's HTML5 then the input-tag has no closing / slash
maybe you want to share some of the php that generates the html
I found the problem : the JQuery() function ($()) don't like being feed with a string beginning with a newline. A simple trim()-like regex .replace() have solved the problem. Thanks everyone for your help.
I am trying to get response from a php page using jQuery Ajax. Everything works fine until I tried to explode an array and combined it elements to get a time 09:00.
Console says, Uncaught Error: Syntax error, unrecognized expression: unsupported pseudo: 00 and nothing displayed.
My code is,
$starttimeArr= explode(",",$comma_separated_starttime);// explodes 09,00,00
$endtimeArr= explode(",",$comma_separated_endtime);// explodes 17,00,00
echo $starttime= $starttimeArr[0].":".$starttimeArr[1];// combine to get 09:00. The line pop up the error
$endtime= $endtimeArr[0].":".$endtimeArr[1];// combines to get 17:00
How did I overcome this error? Any help will be appreciated.
My Ajax code is
jQuery("#_dob").change(function() {
jQuery.ajax({
url: "<?php echo $this->getUrl('deliverybydatepro/index/index') ?>",
data: "checkIn="+jQuery(this).val()+"&type=calendar",
type: "GET",
dataType: "html",
success: function(data) {
var $response=jQuery(data);
jQuery("#div1").html(data);
}
});
});
The response page has a dropdown having an option "09:00". jQuery-1.8.0 triggers an error on it.
Okay. Having seen the edited question with the JS code, the problem is clear:
var $response=jQuery(data);
This line is the cause of the error.
The data variable is the response string from the AJAX request. This contains the string "09:00", as expected.
This means that your code is equivalent of calling jQuery('09:00').
jQuery will try to interpret that as a CSS selector. It will see the 09 and try to find an element with that name. It won't find one of course, but it won't complain about that. However it will then see the :00 and assume that's a pseudo-selector (like :before or :first-child, etc). Of course :00 is not a valid pseudo-selector, and jQuery will complain about that. So that's where the error is coming from.
So what to do about it? Well the answer is quite simple, really.
You're using this line to set a variable called $response, but then you're never using that variable; you're continuing to use the data variable. So really the whole of the line that is throwing the error is completely unnecessary. You may need a line like that if your PHP is outputting JSON or XML data, but not if it's a plain string.
So the solution is to remove that line entirely.
Hope that helps.
Just as an aside, to help you out for next time, it would have been fairly easy to find out which line of JS code was causing the problem by using the debugger in the browser. Just open the Dev Tools or Firebug, and run the code, and it would stop and show you exactly where the error is. A little bit of further work with the debugger looking at variables, and it would probably have become clear what the problem was.
The php-answer is right, it sent the text '09:00' to javascript , but jQuery throws an error: "Uncaught Error: Syntax error, unrecognized expression: unsupported pseudo: 00", maybe ajax-answer is used as the determinant of element, maybe other . Show your js-code, because it throws an error
jQuery(data) was taken as the definition of an element with the pseudo-selector '09:00' and say that :00 - unsupported pseudo, becose there is the pseudo-selectors: first-child, hover, active and etc.
In this strings:
var $response=jQuery(data);
jQuery("#div1").html(data);
the string "var $response=jQuery(data);
is not needed, without this string script would work.
What is the error in this CSS class?
.ux-row-action-cell .x-grid3-cell-inner {
padding:1px 0 0 0;
}
I don't see any error in ASP.NET, but when I am using the same CSS in PHP, Firebug says "syntax error".
Perhaps your selector is what's causing the issue... Try adding a comma in between:
.ux-row-action-cell, .x-grid3-cell-inner
It would be helpful if we could get a bigger snippet of the code around that line. Static strings would be output the same either way, so possibly a malformed piece of your dynamic code is causing the syntax error. The syntax for that one line is correct.