Ajax doesn't work. it doesn't show any errors


Ati

I am using Ajax in my application. Previously it worked fine and checked many times. Not working now. I didn't change anything in this code.

I checked the URL path and also checked the Jquery click event.

It doesn't show any errors in the console log.

$(".submit").click(function(event) {
    event.preventDefault();
    var month = $("#month").val();
    var zone = $("#zone").val();    
    $.ajax({
      type: 'POST',
      url: '<?php echo base_url().'index.php/ContMain/generate'; ?>',
      dataType: 'json',
      data: {month: month, zone: zone},
      success: function(res) {  
         alert(res);
      }

   });
});
evil
  1. Use chrome to visit the page, then press F12 then Tab to enter the network panel.
  2. Make sure the request URL is valid, the status code is equal to 200, and the request headers are valid.

enter image description here

  1. code like this to display results or errors

<script>
  $.ajax({
    type: 'POST',
    url: "<?php echo base_url().'index.php/ContMain/generate'; ?>",
    dataType: 'json ', 
    data: {
      month: month, 
      zone: zone
     }, 
     success: function(res) { 
      console.log('success', res);
     },
     error: function(err) {
      console.log('error', err);
     }
   );
</script>

Related


jQuery code doesn't work but also doesn't show any errors

Lionheart Nerd I have some jQuery code that calls into a separate PHP file (which also contains a jQuery countdown clock), and although no errors are displayed, no jQuery code seems to be loaded. The code I use to call the stats_bar.php file is: <?php if(i

jQuery code doesn't work but also doesn't show any errors

Lionheart Nerd I have some jQuery code that calls into a separate PHP file (which also contains a jQuery countdown clock), and although no errors are displayed, no jQuery code seems to be loaded. The code I use to call the stats_bar.php file is: <?php if(i

pygame.font doesn't work and doesn't show any errors

Amar Prakash Pandey Everything works fine except the font, I don't know why this is happening, it doesn't even show any errors. without displaying the text on the screen. # import library here import pygame import time import sys # display init display_width

jQuery code doesn't work but also doesn't show any errors

Lionheart Nerd I have some jQuery code that calls into a separate PHP file (which also contains a jQuery countdown clock) and although no errors are displayed, no jQuery code seems to be loaded. The code I use to call the stats_bar.php file is: <?php if(is

jQuery code doesn't work but also doesn't show any errors

Lionheart Nerd I have some jQuery code that calls into a separate PHP file (which also contains a jQuery countdown clock), and although no errors are displayed, no jQuery code seems to be loaded. The code I use to call the stats_bar.php file is: <?php if(i

Python asyncio doesn't show any errors

superman I am trying to get some data from thousands of URLs by using asyncio. Here is a brief overview of the design: QueuePopulate a bunch of URLs at once with one URLProducer generate a bunchConsumers Each Consumerkeeps fetching urls from Queueand sending G

Python asyncio doesn't show any errors

superman I am trying to get some data from thousands of URLs by using asyncio. Here is a brief overview of the design: QueuePopulate a bunch of URLs at once with one URLProducer generate a bunchConsumers Each Consumerkeeps fetching urls from Queueand sending G

PHP doesn't show any errors

UserIsCorrupt I know this question has been asked many times in the past, but none of the solutions worked for me. Here is my PHP code: <?php function ?> This should generate an error. However, it just returns a 500 error and doesn't load. I tried the less

Python asyncio doesn't show any errors

superman I am trying to get some data from thousands of URLs by using asyncio. Here is a brief overview of the design: QueuePopulate a bunch of URLs at once with one URLProducer generate a bunchConsumers Each Consumerkeeps fetching urls from Queueand sending G

Python asyncio doesn't show any errors

superman I am trying to get some data from thousands of URLs by using asyncio. Here is a brief overview of the design: QueuePopulate a bunch of URLs at once with one URLProducer generate a bunchConsumers Each Consumerkeeps fetching urls from Queueand sending G

Electron window doesn't open but doesn't show any errors

Jeff Context: I 've seen this question, but it doesn't solve my problem. When I try to run my electron app, I don't get any errors and it seems to compile, but the electron window doesn't pop up. Reply: Date: 2019-05-08T03:02:22.036Z Hash: 3303fd48d099a538493f

ionic cordova doesn't build but doesn't show any errors

Tristan I just made a "new" ionic app, but I can't get Cordova to build the APK. I put the new quotes because I created a new project and copied over from the previous project's src. Something went horribly wrong with the dependencies of the plugin installed o

Electron window doesn't open but doesn't show any errors

Jeff Context: I 've seen this question, but it doesn't solve my problem. When I try to run my electron app, I don't get any errors and it seems to compile, but the electron window doesn't pop up. Reply: Date: 2019-05-08T03:02:22.036Z Hash: 3303fd48d099a538493f

Electron window doesn't open but doesn't show any errors

Jeff Context: I 've seen this question, but it doesn't solve my problem. When I try to run my electron app, I don't get any errors and it seems to compile, but the electron window doesn't pop up. Reply: Date: 2019-05-08T03:02:22.036Z Hash: 3303fd48d099a538493f

ionic cordova doesn't build but doesn't show any errors

Tristan I just made a "new" ionic app, but I can't get Cordova to build the APK. I put the new quotes because I created a new project and copied over from the previous project's src. Something went horribly wrong with the dependencies of the plugin installed o

POST method doesn't work but doesn't show any error

Kotlin I am new to PHP. I'm using the below code in my project and it doesn't work, but no errors are thrown. I tried to convert it to GET method but it still doesn't work. PHP is my frontend and MYSQL database is my backend. I have created the table in the ba

POST method doesn't work but doesn't show any error

Kotlin I am new to PHP. I'm using the below code in my project and it doesn't work, but no errors are thrown. I tried to convert it to GET method but it still doesn't work. PHP is my frontend and MYSQL database is my backend. I have created the table in the ba

POST method doesn't work but doesn't show any error

Kotlin I am new to PHP. I'm using the below code in my project and it doesn't work, but no errors are thrown. I tried to convert it to GET method but it still doesn't work. PHP is my frontend and MYSQL database is my backend. I have created the table in the ba

MSBuild won't deploy and doesn't show any errors

Mohammad Rostami Sehqli I am trying to publish my project using MSBuild. This is an order: "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" D:\HamrahFarda\KhandeShow\KhandeShow.sln /t:UserService /p:DeployOnBuild=tru

MSBuild won't deploy and doesn't show any errors

Mohammad Rostami Sehqli I am trying to publish my project using MSBuild. This is an order: "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" D:\HamrahFarda\KhandeShow\KhandeShow.sln /t:UserService /p:DeployOnBuild=tru

MSBuild won't deploy and doesn't show any errors

Mohammad Rostami Sehqli I am trying to publish my project using MSBuild. This is an order: "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" D:\HamrahFarda\KhandeShow\KhandeShow.sln /t:UserService /p:DeployOnBuild=tru

MSBuild won't deploy and doesn't show any errors

Mohammad Rostami Sehqli I am trying to publish my project using MSBuild. This is an order: "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" D:\HamrahFarda\KhandeShow\KhandeShow.sln /t:UserService /p:DeployOnBuild=tru