Languages

Menu
Sites
Language
HTTP Post Problem

Hi! I have a problem with Tizen.

I use a html form with method POST and it doesn't working. With method GET it works. Chrome Inspector shows the request but with status cancelled. Any idea?  

Edited by: Brock Boland on 17 Mar, 2014 Reason: Paragraph tags added automatically from tizen_format_fix module.

Responses

8 Replies
Lakshmi Grandhi
Hi , Can you please share your code to check. Below code is working fine. var request = $.ajax({ type: 'GET', url: theUrl_current, dataType: 'json', data: {}, async: true, cache: false, });
Konstantinos Chatzigeorgiou
Hi. Thanks for your answer. For example this code make the request but doesn't send the data (var name). The result is "Undefined index: name in..." $.ajax({ type: "POST", url: "http://localhost/script.php", data: { name: 'John' } }).done(function( msg ) { alert( "Data Saved: " + msg ); });
Konstantinos Chatzigeorgiou
It's done. $.ajax() with type POST works. I forgot to make a change to the script. The problem is when I use $.post() or a form without jQuery. The program open the page in the browser but doesn't send data. So, PHP output "Undefined index: name in...".
Konstantinos Chatzigeorgiou
It's only works in Simulator, not Emulator. If I run it with debugger in Network every time I click the submit button it makes a request with the above data: Name -> empty Method -> GET Status -> (canceled) Request cancelled Type -> Pending Initiator -> [native code]:0 Script My code: $("#myForm").submit(function(event) { event.preventDefault(); var $form = $(this), name = $form.find('input[name="name"]').val(), action = $form.attr('action'); var request = $.ajax({ type: 'post', url: action, data: { "email": email, "password": password, "firstName": firstName, "lastName": lastName }, beforeSend: function() { console.log("beforeSend"); } }); request.done(function(data) { console.log(data.result); }); request.fail(function(data) { console.log("fail"); }); }); };
Lakshmi Grandhi
Hi, Did u add gave "Access" permission for url in config file. For more details go through https://developer.tizen.org/help/topic/org.tizen.web.appprogramming/html/app_dev_process/accessing_external_network_resources.htm url
Konstantinos Chatzigeorgiou
Yes. I tried with the IP address of my PC. Network URL -> http://192.168.100.241 Allow subdomain -> Yes And with full path. Network URL -> http://192.168.100.241/script.php Allow subdomain -> Yes
Lakshmi Grandhi
Hi, Is this ip address you are trying to access is not in public domain ??, emulator is like an OS, it cannot access your client on your local system.
Konstantinos Chatzigeorgiou
Thanks for your answer. I deleted network access details and gave the IP address again and now works.