Ajax requests works locally but fails on host

hello,
i am developing a project that uses ajax requests, as i test this project on my local xampp server it works like a charm but if i test it on a host some of ajax requests fails.
example : the response should be 0
but it returns the whole page source code.

  • I also had checked the console network logs

i have no idea about it! :pensive:

this is the code :

//submit forms
  $scope.formSubmit = function(id,fn){
    if ($scope.myForm.$valid) {
        var formInput = $('#'+id).serializeArray();

        //1st lvl of adding
        $http.post('inc/fc/class/formdb.php',{wf_id:id}).success(function(resp){
          if(resp == ''){
            $scope.workflowOptions = [];
          }else{
            $scope.workflowOptions = resp;
            $scope.first_receiver = $scope.workflowOptions[0].user;
            $.ajax({
              type:'POST',
              url:'inc/subfc/submitform.php',
              data:{formName:fn,rec:$scope.first_receiver,formData:JSON.stringify(formInput),formId:localStorage.getItem('thisFormId'),user:sessionStorage.getItem('user')}
            }).success(function(data){
              if(data == 1){
                $('#ajax_messages_head').html('doc confirmation');
                $('#message').html('your doc has been submited. <i class="fa fa-check fa-fw" style="color:green;"></i>');
                $('#ajax_messages').modal('show');
              }
            }).error(function(data){
              $('#ajax_messages_head').html('doc confirmation');
              $('#message').html('sorry something went wrong. <i class="fa fa-remove fa-fw" style="color:red;"></i>');
              $('#ajax_messages').modal('show');
            });
          }
        });
    }
  };

Welcome to SitePoint, @Saleh_Asadi. It will be very hard for people to help you unless you post your code here for people to see. To format it, place three backticks (`) on the line before the code, and three backticks on the line after it. Or you could highlight the code and select the </> icon from the icon list above the edit area.

thanks for your advise. ok i’ll do it.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.