WordPress Hosting
Free Photos
WordPress Themes

jQuery Ajax & Get JSON Array

$.ajax({ type: 'POST', url: 'url.php', data: 'nombre=' + $('#nombre').val() + '&' + 'edad=' + $('#edad').val(), dataType: 'json', success: function(data){ var html = ''; $.each(data,function(index,user){ html+= '<div class="user"><p>' + index + '</p>'; html+= '<p>' + user.user_edad + '</p></div>'; }); $('#users').html(html); }, error: function(data){ alert('Error:' + data); } });

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.