php - angularjs cannnot use $http.jsonp for send POST method -


please, have been using lort of examples none of them send post method.

we have lot of services in angularjs posting this:

            $http.post(url + '/login.php?action=login_user', data).success(function(response, status) {                 callback(response, status);             }).error(function(response, status) {                 callback(response, status);             }); 

where data allways json data or more complex:

            var data = {                 username: username,                 password: password             }; 

and need adap lot of calls jsonp minimum change soo try send data post json previos changing (using jsonp)

            $http.jsonp(url + '/login.php?action=login_user&callback=json_callback', data).success(function(response, status) {                 callback(response, status);             }).error(function(response, status) {                 callback(response, status);             }); 

but looking inspector not sending post json data. why?

is because $http.jsonp never use post , method? how can send our json data object post ?

we use php in server, never see full example using angularjs sending jsonp post php , dont know how the posting vals in php.

so in php send json using jsonp in angular how must send form php angularjs.

our web working ok not using jsonp in angularjs need change usin jsonp.

a full simple example call angularjs , how ph post , send json lot because after searching lot not find.

please, in advance , hope can other

i think suit better - simple post method in angularjs

$scope.executenowbuttons = function () {     // $scope.datetimess = $filter('date')(new date(), 'dd-mm-yyyy hh:mm ');     // console.log(datetimess);     // alert($scope.today);     var pulldataurl = 'http://192.168.1.20:8082/resources/scheduleexecutejob/scheduleexecutejob';     var pulldata = {         "execprogms": "dedup",         "delid": "",         // "datimevalue": "18-jul-2017 12:20",         "datimevalue": $scope.datetimes,         "username": "admin"     };     $http.post(pulldataurl, pulldata)         .success(function (data) {             var msg;             alert(data.msg)                 // location.reload();                 //$location.path('/importer/merge')                 //$scope.getalldatatreeview();         })         .error(function () {             alert("session time out")         }); }; 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -