javascript - AJAX POST TO PHP -


datastring :

{"feedback_type":"000","error_type":"","textarea":"blahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblah"} 

i used following code post php:

// ajax post $.ajax({     type: "post",     url:  "core/poster.php" ,     data:  datastring,     success:function()     {         alert("success!");     } });  return false; 

and php file:

<?php  require 'class_dboperation.php'; require 'global.php';  // establish database connection $dboperation = new class_dboperation(dbhost,dbuser,dbpwd,dbname,dbcharset);  // receive datastring $content=$_post['feedback_type']; $run=mysql_query("insert reports values (null, '".$content."')");  ?> 

the problem why $content empty? should ? ideas?

add response in success function , alert it

$.ajax({     type: "post",     url:  "core/poster.php" ,     data:  datastring,     success:function(response)     {         alert(response);     } }); 

and in poster.php file try adding following top within php tag.

ini_set("display_errors", 1); var_dump($_post); 

this should give place start , debug what's going on.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -