I'm new to Rails and I was trying to right very simple ajax call in application.js.
Here's the code:
function login(loginUrl) {
    alert(loginUrl);
    $.ajax('http://www.w3schools.com/jquery/demo_test.txt', {success: function (result) {
        alert(result);
    }});
}
When the function is called, the first alert works well. However, it seems that the following ajax call never gets through and the second alert never executes. I tried the code at w3school.com and it works well. I'm really confused why this simple code doesn't work with Rails.
Could anyone please help me?
 
     
     
     
    