20571

(Intel XDK) can´t use a 'Post' form to use a PHP function

Question:

I developed an HTML5 application. I want to use it on Intel XDK and all works fine with one exception, a Form with a 'POST' action to use a PHP function which saves a chosen image into a application folder. When I try to use it I get the following error:

Cannot POST /http-services/emulator-webserver/ripple/userapp/x/C/Users/XXXXXXXXX/Documents/Proyectos/centerinformaticapp/www/guardarImg.php

How can I make it work? Can anybody give me an example?

Answer1:

You have to make Use of Ajax or XHR.

var formData=$('#formId').serialize(); var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (xhttp.readyState == 4 && xhttp.status == 200) { console.log("success"); } }; xhttp.open("POST", "http://yoursite.com/abc.php", true); xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xhttp.send(formData);//your post data

Recommend

  • PHP file using mysqli_query
  • VS2015 + TypeScript + Cordova + Angular2 + SystemJS
  • Change TextView background with ripples
  • Build doesn’t produce apk
  • Error 400 (Bad Request) from Visual Studio 2015 Ripple
  • jBoss issue with binding to a specific port
  • Android how to create ripple effect in Java
  • Eclipse RCP - Update
  • PassportJs, local strategy cannot be found
  • Any IE9 Alternative to localStorage that will work with file:// on the Windows 7 phone?
  • Apache DELETE request
  • WCF Service Application returns 404 using WebGet
  • Saving image file path to sqlite database
  • Is Android development possible on netbooks? [closed]
  • Are Richfaces and Primefaces compatible with each other?
  • Request response issues in biztalk
  • Android cannot disable cut copy paste
  • cordova is not defined - cordova.js has already been loaded :: Ionic
  • Clear fused location provider's location for testing
  • ASP.NET MVC 2 Preview 2 - display directory list rather than home/index
  • azure media services - The request body is too large and exceeds the maximum permissible limit
  • Cannot resolve symbol 'MyApi'
  • Change Inet root folder for iis 7
  • Paperclip, set path outside of rails root folder
  • Do I've to free mysql result after storing it?
  • QuartzCore.framework for Mono Develop
  • Python - Map / Reduce - How do I read JSON specific field in using DISCO count words example
  • Warning: Can't call setState (or forceUpdate) on an unmounted component
  • Is there a mandatory requirement to switch app.yaml?
  • bootstrap to use multiple ng-app
  • How to get icons for entities from eclipse?
  • Proper folder structure for lots of source files
  • Load html files in TinyMce
  • Hits per day in Google Big Query
  • FormattedException instead of throw new Exception(string.Format(…)) in .NET
  • Turn off referential integrity in Derby? is it possible?
  • Linking SubReports Without LinkChild/LinkMaster
  • Append folder name and increment by 1 using batch script
  • XCode 8, some methods disappeared ? ex: layoutAttributesClass() -> AnyClass
  • JaxB to read class hierarchy