hello i have the code bellow:
<script type="text/javascript">
14 $(document).ready(function() {
15 $('#find').click(function(){
16
17 var amount = $('#amount').val();
18
19 $.ajax({
20 type: "POST",
21 contentType: "text/xml;charset=utf-8",
22 url: "questions.php",
23 data: {'amount': amount},
24 success: function(data){
25
26 $('#results').show();
27
28
29 $('#results').html(data);
30 }
31 });
32 });
33 });
34 </script>
and my php script has the code below
5 $search_term = $_POST['amount'];
6 echo $search_term;
if i remove line 21 with content type thing i get the input as output but with that i get nothing as output! The thing is that i really need the content type thing so any info on that would be really helpful!
You’re sending the data as form data, but declaring the sent data as XML. PHP cannot parse JSON data when it’s expecting XML so doesn’t return anything. And it’s optional to set
contentType.From the jQuery Documentation: