I'm trying to send a post request using jQuery
in my .php file. I have a button that on click runs the JS method and then after validation sends the requests.
Anyway, it doesn't work yet because it throws error "$.ajax is not a function"
. When I'm on the site I can see in the sources that I have imported two jQuery files (the second one from bootstrap which doesn't contain ajax calls). So I started wondering about jQuery.noConflict()
function.
I implemented the call as here is described.
var jq = jQuery.noConflict();
jq.ajax({
type: 'POST',
url: 'order.php'
});
Still without any result. Same error - only changed to jq.ajax is not a function.
I got this line in my index.php
header section and below that bootstrap. Switching them doesn't change anything.
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
If it is important: I have index.php
file which contains this header. Then in the body section, I'm switching to subpages based on the $_GET
PHP function, redirecting to the parent parentorder.php
file, then if the user is logged I'm including order.php
file which displays additional content and should handle orders.
So I was thinking maybe there is some error with my includes or so but if I can see in the section 'sources' jQuery file that should mean it is imported properly, right?