You can use try catch, ie.

try{
$.get('http://www.example.com/',function(response){
  var someText = $(response).find('#myDiv').text();
  alert('success');
});
}catch(err){
//put code to handle error
}


..fredrik

On Aug 18, 6:34 am, nick <[email protected]> wrote:
> The page im loading with $.get has a syntax error that is killing my
> entire script. Is there anyway to test if it contains a syntax error
> and/or just ignore it?
>
> $.get('http://www.example.com/',function(response){
>   var someText = $(response).find('#myDiv').text();
>   // Script doesnt run after this because response contains a syntax
> error
>   alert('success');
>
>
>
> });

Reply via email to