₦airaland Forum

Welcome, Guest: Register • Login • With Google • Trending • Recent • New

Stats: 3,344,275 members, 8,511,008 topics. Date: Saturday, 31 October 2026 at 03:30 PM

Toggle theme

Php Json Help - Programming - Nairaland

Nairaland Forum › Science/Technology › Programming › Php Json Help (666 Views)

1 Reply

Php Json Help by Taiw(op): 12:16pm On Jul 09, 2015
I am trying to create a login system using json like this $data_string = '{"email_address":"'.$semail.'","device_type":"WEB","password":"'.$spass.'","action":"signin"}';

I am using jQuery AJAX Call to PHP Script with JSON Return in a .js file i have. The problem i have is i dont want it to return json in ajax. i want to be able to decode my json return from php.

The problem lies in the ajax
$.ajax({
type: "POST",
dataType: "json",
url: "ajax.php",
data: data,
success: function(result){
// alert(result.responseCode);
if (result.responseCode == 'X1') {
// alert(result.responseMessage);
window.location.replace('index.php');
} else {
// Display result.responseMessage
alert(result.responseMessage);
}
}

I noticed extra lines of codes wont work in my php file. So i am looking for a way to post this without the success method
Re: Php Json Help by spikesC(m): 1:31pm On Jul 09, 2015
Am a little bit confused but are you trying to build Json data from the form input and send it to php?

If it's so then that is quite unnecessary. Just do a regular post/get to php and return Json from php to Ajax
1 Reply

Jamb Past Questions API In JSON • Programming Challenge: Convert String to Json with a Loop • List Of All States With Local Governments In Nigeria In JSON, PHP And SQL Format • 2 • 3 • 4

Need Android Apps? Contact A Reliable Developer Using Latest Release 08077922440 • Verified Adsence With Pin/address Present A/c Bal: $30 For Sale @ Cheap Rate • Most See