Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resource requests whose URLs contain raw newline characters are deprecated in jQuery

Tags:

jquery

Does anyone know what this warning is referring to and how I would go about resolving it?

 Resource requests whose URLs contain raw newline characters are deprecated, and may be blocked in M60, around August 2017. Please remove newlines from places like element attribute values in order to continue loading those resources. See https://www.chromestatus.com/features/5735596811091968 for more details.

I am getting above description in console

I am trying to use pass url in $.getJSON method. i am getting url in alert box but it can't goes to controller class.

My code here:

function LoginSucessInfo( result )
{       
    var id = "6546767576657";       
    url =  "/logindetails?id="+id+"&result="+result;
    alert(url);
    $.getJSON(url, function(data1){
        alert("--");
    });     
}

What's wrong in my code?

like image 919
Durga Avatar asked Sep 13 '17 17:09

Durga


2 Answers

There might be newline characters or HTML or whitespace in result. Sanitize result using encodeURIComponent

...
result = encodeURIComponent(result);
url =  "/logindetails?id="+id+"&result="+result;
...
like image 105
Vinu Avatar answered Nov 15 '22 06:11

Vinu


I believe when you modify your URL variable to something like the one I suggested below it will solve the problem:

url = encodeURI("/logindetails?id="+id+"&result="+result;);
like image 31
Marcel Avatar answered Nov 15 '22 06:11

Marcel