Tuesday 15 September 2015

php - AJAX not sending data / possible incorrect syntax? -


I can not send my form data for sending. My scenario: The page 'user.php' holds a form. The text field inside should send data to up_cap.php, then it should be sent back to user.fp and any page should be displayed without refresh.

So basically: the information of the user type in a text field, then submit it without the page refresh appears in the next data .php is not being received by the page

I believe my problem is that changing the form data in AJAX information or AJAX syntax in PHP. I am working on it for two days! Any help / consideration greatly appreciated.

I am closing my code:

HTML (user.php)

  & lt; Div id = "the_boxx" class = "popup 2" & gt; By & lt;? Includes 'up_cap.php'? & Gt; & Lt; / Div & gt; & Lt ;! - End Popup - & gt;   

HTML form (user.php)

  & lt; Form name = "cap_update" & gt; & Lt; Input id = "c_a_p" name = "c_a_p" value = "" size = "30" square = "valid [required] input" type = "text" /> & Lt; Div class = "clearfix;" & Gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; Button ID = "update_info" type = "submit" style = "float: right; padding-left: 10px; pad-right: 10px;" Class = "chg" & gt; Update & lt; / Button & gt; & Lt; / Form & gt;   

JAVASCRIPT (located at the bottom of the user.php body)

  & lt; Script & gt; $ ('. Chg) Click (function () {var c_a_p = $ ("# c_a_p"). Val (); $ .ajax ({type: "POST", url: "up_cap.php", data: "C_a_p", success: function () {$ ('# The_boxx'). Load ('up_cap.php')}}); return returned;}); & Lt; / Script & gt;   

PHP (up_cap.php)

     

probably this way :)

  : {Key: value}   

and php

  $ _ POST ['key']   

Good luck!

No comments:

Post a Comment