Click here to Skip to main content
15,884,648 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i get,TypeError: $.ajax is not a function, in the console of the firebug for the code below.
How to solve this?
C#
function cropImage() {
    debugger;
    var x = 10;
    var y = 30;
    var w = 50;
    var h = 80;
    $jQuery.ajax({
        type: 'POST',
        contentType: "application/json; charset=utf-8",
        dataType: 'json',
        url: 'WebService.asmx/ImageCrop',
        data: "{'x':'" + x + "','x':'" + y + "','w':'" + w + "','h':'" + h + "'}",
        async: false,
        success: function (response) {

            alert("Record saved successfully in database");
        },
        error: function () {

            alert("some problem in saving data");
        }
    });
}
Posted
Updated 15-Oct-18 0:11am

There is syntax problem in the code.

Either write jQuery or $. Don't mix those two...
So, write...
JavaScript
jQuery.ajax({

    //.....
    //....

});

OR
JavaScript
$.ajax({

    //.....
    //....

});
 
Share this answer
 
Comments
Nirav Prabtani 6-Jun-14 10:00am    
my 5+
Thanks Nirav. :)
thedinesh01 9-Jun-14 0:15am    
jQuery.ajax works for me but $.ajax dont work for me.. can you tell me why?
thedinesh01 9-Jun-14 0:15am    
jQuery.ajax works for me but $.ajax dont work for me.. can you tell me why?
I have faced the same problem,
Uncaught TypeError: $.ajax is not a function

the solution for this is: the library your're using if it is slim one then $.ajax is not a function there try using the full jquery library . . . and good luck
 
Share this answer
 
Comments
Richard Deeming 16-Oct-18 11:25am    
jQuery "slim" was released in June 2016, two years after this question was posted. It's hardly likely to have been the cause of the problem!

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


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