I've got the weirdest problem. Firstly I'm looking to create a user for my website. I made a RESTful api for the application. Now the problem I am having is:
- When ever I click the button to run the $.getJSON js function, it returns TRUE BUT when I check the db, the db hasn't changed.
- Now the same link that would appear to do nothing to the db when I console.log() the link and open it in another window it works and inserts into the db. THE LINK IS EXACTLY THE SAME.
My problem is I have no idea why the link sends back true in the $.getJSON function but doesn't update the db but in a new browser window it updates the db because I'm querying the exact same link, with the exact same backend code and the same db.
Here is the $.getJSON function
var LinkSend = AddressAccess + "Home/usercreate/name/"+response.first_name+"/surname/"+response.last_name+"/email/"+response.email+"/contact/"+numberfacebook+"/password/"+null+"/university/"+universityfacebook+"/FB/"+response.id+"/format/json";
$.getJSON(LinkSend,
function(data)
{
console.log(data.result);
console.log(LinkSend);
}
$.getJSON does everything correctly just that it never updates the db, how is this even possible? I know the question is a bit flimsy but as people help I'm more than happy to post code as need to identify the problem. I'm also not sure if its a server problem or an internet connection problem?
The internet connection I'm using isn't stable so I don't know if packets are being dropped and for some reason the server replies with a 'true' even though it wasn't inserted into the db.
I'm also using a hostgator server, so I don't know if for some weird reason as the php tries to insert into the db, for some reason its not able to?
Like I said I'm not 100% why this is happening. Any help would really be appreciated.