user3003063
user3003063

Reputation: 29

Jquery/JSON issue

I'm trying to use the following code to get the availability of a domain name

var domurl = 'http://XXXXXXXXX.co.uk/domchek.php?domname=google.com';

$.getJSON(domurl, {data: "available"}, function(json) {
  $("#enterone").html(json.available);
});

The JSON returned is

{"status":"success","domain":"google","available":false}

If I use

  $("#enterone").html(json.status);

It returns success as expected but if I try and return available it returns nothing. My guess is because false is not a string (domain also works)

Any ideas? Thanks

Upvotes: -1

Views: 42

Answers (1)

Arun P Johny
Arun P Johny

Reputation: 388436

An easy fix could be

$.getJSON(domurl, {data: "available"}, function(json) {
  $("#enterone").html(json.available + '');
});

Upvotes: 1

Related Questions