I have trouble with my Ajax call when I try to warn the result, the result is undefined .
Both alerts are result of being undefined. I'm not sure if I'm coding it correctly, please help me.
Q: If I am using it incorrectly, how do I use the skill property / index?
JQUERY / JSCRIPT
$ (document) .ready (function () {// Change on skill sort $ ('# order_by' ). 'Change', function () {$ .ajax ({type: "post", url: "sort_skill_be.php", datatype: "jason", data: {skill: this.value}} done (work) (Result) {Warning (Results [0] .skill);})});}); PHP file: This method receives a statement and puts an "object" array in an aggregate array.
function helpFetchPostInfo ($ Stmt) {$ result = $ stmt-> Fatch ALL (); $ Recent_posts = Array (); $ Line ['steam'], 'skill' => $ Line ($ result as $ line) {$ post = array} ('username' = & gt; $ row ['username'], 'steam' = & gt; ['skill'], 'description' = & Gt; $ line ['description'], 'date' = & gt; $ line ['date'],); Array_press ($ recent_page, $ post); } Return json_encode ($ recent_posts); } Thanks very much for the help
function sort socket ($ skill) {// if all the skills are displayed normally Posts are selected (if $ skill == 'all') {displayPosts (); Go out; } $ Db = connect (); $ Sql = "SELECT * Users · Users · IDUsers · Join posts on Posts · Posts · FQEE Posts · No FQU and Users. Skill: = Date by skill DCSC"; $ Stmt = $ db- & gt; Ready ($ sql); $ Stmt- & gt; Execute (array (': skill' => $ skill)); If ($ stmt-> rowCount () == 0) {// nothing was set back ($ _ session ['recent_posts']); // Reset the session to terms, if no terms appear} and {$ recent_posts = helpFetchPostInfo ($ stmt); $ Recent_posts return; }} The sequential skill is being called in a separate php file, which is sorted by ctrl_b.f. It is said, that a selection is changed when jquery is called.
& lt ;? Php session_start (); Included 'database.php'; $ Skill_sort = $ _POST ['skill']; SortSkill ($ skill_sort); Header ('location: index.php'); ? & Gt; Edit: jquery added JSON datatype
Now my problem is that the alert is no longer being called.
It looks like you type your AJAX method in dataType < / Code> attribute are not provided.
Type the data: "Jason", Do this either or parse your result before accessing it From JSON
I do not see any problems trying to reach the object.
No comments:
Post a Comment