1

Hi I am trying to update my css file by using a combination of php ajax and jquery, I am doing it like this as I want users to be able to download the css file with the modified values in it. However I am getting an

$.ajax is not a function

error in my code and I'm not exactly sure why, I have included the full jquery library in my code, I have tried using jQuery.ajax instead of $.ajax but this still hasnt resolved it.

this is the version of jquery i am using

https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js

this is my code

 $(document).ready(function(){   
   $("#colorpicker").on("change",function(){
     var backgroundColour = $(this).val();
     console.log(backgroundColour);

     $.ajax({url: "styles.php", type: "post", data: backgroundColour});

  });
 });  
14
  • 1
    Are there other libraries you are using? Is $ aliased to jQuery? jQuery is not the only library that uses $ Commented Apr 11, 2018 at 17:08
  • 1
    Have you confirmed that the jQuery library is actually loading by viewing the request for it in your developer tools? Commented Apr 11, 2018 at 17:09
  • @ Patrick Evans I am using bootstraps jquery library as well but I have used the both of these in a different project before and they worked without any errors Commented Apr 11, 2018 at 17:20
  • you have the exact same error when calling jQuery.ajax ? Commented Apr 11, 2018 at 17:22
  • @ValLeNain yeah the error is the same regardless of using jquery.ajax or $.ajax Commented Apr 11, 2018 at 17:37

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.