Note that there are some explanatory texts on larger screens.

plurals
  1. POphonegap with codeigniter backend
    primarykey
    data
    text
    <p>So I am getting better at using phonegap but am still trying to fully add codeigniter as the backend. I have been able to .load in jquery something from a controller of my CI to my phonegap android app but can't seem to submit anything TO the server properly. Do you need a rest server to communicate with CI from phonegap? I was planning on using ajax post to info to CI but so far unable to get it to work. I'd really appreciate it someone can help me over this hurdle. Thanks</p> <p><a href="https://stackoverflow.com/questions/5884587/what-has-been-the-experience-in-making-a-mobile-app-using-phonegap-and-codeignite/5884857#5884857">link to relative answer</a></p> <p>Controller:</p> <pre><code>&lt;?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Welcome extends CI_Controller { public function index() { //$this-&gt;load-&gt;view('welcome_message'); $data['query']=$this-&gt;site_model-&gt;get_last_ten_articles(); $this-&gt;load-&gt;view('partial1',$data); } public function addarticle(){ $headline=$this-&gt;input-&gt;post('headline'); $article=$this-&gt;input-&gt;post('article'); $this-&gt;site_model-&gt;insert_entry($headline,$article); } } </code></pre> <p>Javascript(on phonegap device) </p> <pre><code>function add_article(){ $.ajax({ type: 'POST', url: 'http://testlab.site40.net/droiddev/welcome/addarticle/', data: {"headline": "test headline","article": "test article"} error: function(){alert('fail');}, success: function(data){ alert('article added'); }, dataType: "json" }); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload