{"id":6517,"date":"2014-04-20T07:19:27","date_gmt":"2014-04-20T07:19:27","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/04\/20\/json-jsonp-not-connecting-to-php-phonegap-jquerymobile-collection-of-common-programming-errors-2\/"},"modified":"2014-04-20T07:19:27","modified_gmt":"2014-04-20T07:19:27","slug":"json-jsonp-not-connecting-to-php-phonegap-jquerymobile-collection-of-common-programming-errors-2","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/04\/20\/json-jsonp-not-connecting-to-php-phonegap-jquerymobile-collection-of-common-programming-errors-2\/","title":{"rendered":"Json \/ Jsonp not connecting to php (Phonegap + jquerymobile)-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li>an android WEB application<\/li>\n<li>with phonegap<\/li>\n<li>layout with JqueryMobile<\/li>\n<\/ul>\n<ul>\n<li>An html form that takes ID, name, and address as input<\/li>\n<li>&#8216;Serialize&#8217;s this data using ajax<\/li>\n<li>makes a json object out of it<\/li>\n<li>Should send it to a file called &#8216;connection.php&#8217;<\/li>\n<li>Where, this data is put into a database (MySql)<\/li>\n<\/ul>\n<ul>\n<li>My server is localhost, Im using xampp<\/li>\n<li>I have already created a database and table using phpmyadmin<\/li>\n<\/ul>\n<ul>\n<li>My html file, where my json object is created, does not connect to the php file which is hosted by my localhost<\/li>\n<\/ul>\n<pre><code> \n \n \n\n \n    \n    \n\n   Trial app\n   \n    \n    \n    \n\n    \n    $(document).ready(function () {\n        $(\"#btn\").click( function() {\n        alert('hello hello');\n\n        $.ajax({\n            url: \"connection.php\",\n            type: \"POST\",\n            data: {\n                id: $('#id').val(),\n                name: $('#name').val(),\n                Address: $('#Address').val()\n            },\n            datatype: \"json\",\n            success: function (status)\n            {\n                if (status.success == false)\n                {\n                    alert(\"Failure!\");\n                }\n                else \n                {\n                    alert(\"Success!\");\n                }\n            }\n        });\n\n    });\n    });\n \n \n\n \n\n\n        <\/code><\/pre>\n<h1><code>Heading of the app<\/code><\/h1>\n<pre>\n    \n\n    \n        \n            \n        \n\n        \n            \n        \n\n        \n            \n        \nAdd record\n        \n    \n\n\n \n\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>an android WEB application with phonegap layout with JqueryMobile An html form that takes ID, name, and address as input &#8216;Serialize&#8217;s this data using ajax makes a json object out of it Should send it to a file called &#8216;connection.php&#8217; Where, this data is put into a database (MySql) My server is localhost, Im using [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-6517","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6517","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=6517"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6517\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=6517"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=6517"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=6517"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}