Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I've encountered the same problem and the only solution I founded is to implement a Phonegap plugin.</p> <p>Here is the C# code I use :</p> <pre><code>namespace WPCordovaClassLib.Cordova.Commands { [DataContract] public class PhonegapWindowsPhonePostObject { [DataMember(IsRequired = false, Name = "yourParamName1")] public string yourParam1; [DataMember(IsRequired = false, Name = "yourParamName2")] public string yourParam2; } public class PhonegapWindowsPhonePost: BaseCommand { public void post(string options) { PhonegapWindowsPhonePostObject pwppo = JSON.JsonHelper.Deserialize&lt;PhonegapWindowsPhonePostObject&gt;(options); try { System.Windows.Deployment.Current.Dispatcher.BeginInvoke(() =&gt; { var data = "YOUR DATA STRING HERE"; //use the pwppo object to retrieve your parameters var url = "URL OF THE SERVICE HERE"; WebClient wc = new SharpGIS.GZipWebClient(); var URI = new Uri(url); wc.Encoding = Encoding.UTF8; wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded"; wc.UploadStringCompleted += new UploadStringCompletedEventHandler(wc__UploadStringCompleted); wc.UploadStringAsync(URI, "POST", data); }); } catch (Exception ex) { Console.WriteLine(ex.Message); } } void wc__UploadStringCompleted(object sender, UploadStringCompletedEventArgs e) { try { if (e.Result != null) this.DispatchCommandResult(new PluginResult(PluginResult.Status.OK, e.Result)); else this.DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, "Error 401")); } catch (Exception ex) { this.DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, ex.Message)); // no http status code available } } } } </code></pre> <p>And here is the Javascript code to call the pluging from your app :</p> <pre><code>function loginToWebService(yourParam1, yourParam2) { var options = { "yourParamName1": yourParam1, "yourParamName2": yourParam2}; cordova.exec(success, error,"PhonegapWindowsPhonePost","post", options); } </code></pre> <p>I hope it will help you.</p> <p>Note : the Phonegap 2.8 version does not solve the problem contrary to what said the release note...</p> <p>Bye !</p>
    singulars
    1. This table or related slice is empty.
    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.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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