<html> <head> <script src="http://code.jquery.com/jquery-latest.min.js"></script> <script> $(document).ready(function() { $.ajax({ type: "POST", url: "test.php", dataType: "xml", success: function(xml){ $(xml).find('response').each(function(){ sString += $(this).find('name').text(); }); alert(sString); } }); }); </script> </head> <body> </body> </html>
Oraz kod pliku test.php
<?php $output = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'; $output .= '<response>'; $output .= '<name>Tomek</name>'; $output .= '</response>'; ?>
I czemu to nie chce działać. Nie wyświetla się alert a powinien z wartością tomek.