Ajax GET does not work


i have ajax that post URL.

What i want to do is switch months inside a modal
it works in simple php file but does not work in my modal :frowning:

My script:

			e.preventDefault(); // Prevent Default Submission
		 url: 'page_machinery_planning_child',
		 type: 'GET',
		 data: $(this).serialize(), // it will serialize the form data
				dataType: 'html'
			 $('#form-content').fadeOut('fast', function(){
				  }, 1);
		 alert('Ajax Submit Failed ...'); 


$next_month = date('Y-m-d', strtotime("+1 months", strtotime(date('Y-m-01',strtotime($date)))));
$prev_month = date('Y-m-d', strtotime("-1 months", strtotime(date('Y-m-01',strtotime($date)))));
echo '
<td align="right" id="submit_formz2"><a href="page_machinery_planning_child.php?date='.$next_month.'"> >> </a>

Any tips for whats wrong?


Set the correct directory at url property eg.page_machinery_planning_child.html or page_machinery_planning_child.php

I think that is not the issue as i have htaccess removing file extension php.
I also tried your idea but that is the same.

Add the extension at file and retry.

i did it nothing changed

What errors do you have?

none it just get back to the same place in modal not changing date in url

I think that the problem is in your php file.I mean that the php code doesn’t produce an html code.I test your code in my IDE and it works.Can you post the php code at page_machinery_planning_child?

done but theres nothing that could be wrong i think

Did you find what is cause?



If you are clicking on a submit button, you won’t get the data with $(this).serialize()
Instead, you should add a submit event handler to the form.

Like this:

This way, you will GET the data to the server.

1 Like

Looks nice thanks :slight_smile:

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