Software Archive
Read-only legacy content
17061 Discussions

Not local AJAX POST doesn't work

Fatih_Mert_D_
Beginner
595 Views

Hi guys,

I new started work with Intel XDK. I like it. But I couldn't ajax post to my web site.
 

Backend (I'm using FlightPHP micro framework for php)

 

<?php
Flight::route("POST /islem/mobil",function(){
	$data = array();
	
	$isim = (string)$_POST['isim'];
	$sisim = (string)$_POST['sisim'];
	
	$data['yanit'] = $isim." ".$sisim;
	
	echo json_encode($data);
});

 

Frontend

$(document).ready(function(){
    $('.ajaxPost').click(function(){
        var veri = {
            "isim" : $('.getIsim').val(),
            "sisim" : $('.getSoyIsim').val()
        };
        $.ajax({
            url: "http://be-vel.com/islem/mobil",
            dataType:"JSON",
            type:"POST",
            data:veri, 
            success: function(cvp){
                $('.sonucYaz').text(cvp.yanit);
            }
        });
    });
});

Where is the error, I don't understand this, because anything show me errors :/
Thank you for interest.

Good works..

0 Kudos
7 Replies
PaulF_IntelCorp
Employee
595 Views

How are you testing this? In the Emulate tab? In the Debug tab? In a built app on a device?

0 Kudos
Fatih_Mert_D_
Beginner
595 Views

I'm trying on Emulate tab.

0 Kudos
PaulF_IntelCorp
Employee
595 Views

Does it work for you if you just use a desktop browser? Make sure it all works there, outside the XDK, first. What you are trying to do is not specific to the XDK, it has to do with making your connection between your client browser and your server work. Once you have that connection working correctly, using a browser, then you should be able to move it to a Cordova app, using the XDK.

0 Kudos
Fatih_Mert_D_
Beginner
595 Views

How do I try on my browser ? I don't know sorry.

Because, node-webkit doesn't like firebug.
Thank you..

0 Kudos
Diego_Calp
Valued Contributor I
595 Views

Fatih Mert D. wrote:

How do I try on my browser ? I don't know sorry.

Because, node-webkit doesn't like firebug.
Thank you..

Hi, emulate tab has its own debugger, second button top left.

Into debugger, you should see errors in Network section.

Regards

Diego 

0 Kudos
PaulF_IntelCorp
Employee
595 Views

Faith, to try in a browser, just open the index.html file in your project in a browser...
 

0 Kudos
PaulF_IntelCorp
Employee
595 Views

This issue with our iOS build system has been resolved, please try again. See > https://software.intel.com/en-us/forums/intel-xdk/topic/611793

0 Kudos
Reply