Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,150,468 members, 7,808,675 topics. Date: Thursday, 25 April 2024 at 03:13 PM

Php Json Help - Programming - Nairaland

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

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)

(1) (Reply)

Php Json Help by Taiw(m): 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)

Wch Is D Best / This Is Being Set Up Again In Dynamic / Wordpress Premium Themes Needed

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 47
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.