Click here to Skip to main content
15,889,116 members
Please Sign up or sign in to vote.
1.33/5 (2 votes)
See more:
what problem in my code why alert(" Error ");

JavaScript
$.ajax({
        type: "GET",
        contentType: "application/json; charset=utf-8",
        url: "http://localhost:3148/api/values/5",

        success: function (data) {
            JSON.stringify(data);
            alert("Success ");
            

        },
        error: function (data) {

            alert(" Error ");
        }
    })


What I have tried:

i don't know where the problem
Posted
Updated 19-Jun-16 5:52am
v2
Comments
Karthik_Mahalingam 20-Jun-16 8:28am    
post the c# method code
Sinisa Hajnal 21-Jun-16 4:23am    
Instead of alert ("error") put console.log(data) into error handler and look at it in the console window. You'll get full error text that will say what and where is the problem. Or you could look at other parameters (textStatus and error) which you're not using in the above code (you're just using data).

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900