How to check if the ajax call method is POST or GET?

isudansh

How do I check if the TYPE used in an AJAX call is POST or GET in my php page/server side?

hsz

Just try with:

if ( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
  // POST
} else {
  // GET
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

POST and GET method probles in ajax call in Laravel 5.2

AJAX call works with GET but not with POST

Ajax call get post intelligence

How to get the return value of a method in a $.ajax (typ get) call?

Ajax POST, check PHP $_GET and then $_POST

How to Pass Data in ajax call using GET Method in javascript

Request method 'POST' not supported for ajax call

How to pass the select check box values dynamically to the ajax call variables post to php variables dynamically

get response when i call the post method

Unable to call web method using AJAX post Jquery method

How to pass data from dropdown list to action method to save data using post jquery ajax call

AJAX / jQuery $.get method works, but $.post does not

How do I change GET method to POST method using php and ajax

How to get ajax post data

How to check if session expired on ajax call?

How to post the parameter in ajax call of jquery datatable

How to get the value from array from custom post and use in my ajax call

NodeJS How to get Data in server, sent from jquery ajax call via POST

How to make an internal method call check

How to mock method call without signature check?

Django : trying to call the get method after the post method for a class view

How to check the content of a POST method in Postman?

How to call a method in vuejs on post load?

How to call an API in Nodejs with post method?

MVC How to call controller post method

data not passing from ajax post method to php call back

Jquery.ajax POST call running wrong method supplied

Unable to call a PHP file using $.post() method of Ajax

Ajax call to ASP post method keep giving null parameter