Friday 15 August 2014

ajax request to php in jquery? -


I had an illustration about a photo / video gallery. A theory of how this will work, I found this website. So I'm trying to understand how it works. .js in AJAX:

  $ Ajax ({url: "work.php? Work =" + hash, data type: "xml", success: function (xml) {var id = etr ("id"); var color1 = ($ (xml). Find ("Data"). Attr ("color1") == ''? 'Ffffff': attr ("color 1"); var color 2 = ($ (xml). Find ("data") .tr ("color 2 ") == ''? 'Noir': $ (xml) .find (" data ") attribute (" color 2 "); var vimeo = $ (xml) .find (" vimeo "). Text () ; Var texte = $ (xml) .find ("Texte"). Text ();   

Does this mean that AJAX sent a php file request to get the XML document request Goes? So the gallery (url, style etc.) is in the XML document? Then the php html page Generates the code for how these images are displayed?

I appreciate a good explanation and advice where I get information on preparing XML and PHP.

It may be below this line where you are in this project, but you should be useful to this data Dynamically want to generate.

Generally, JSON via javascript is used by javascript Using json_encode is easy Dhne make data I PHP on an associative array as easy. When data is parsed on the client side, it appears as a javascript object.

However, if you need to use XML, and looking for a way to convert data (such as a database query) for XML, I highly recommend JMS Serializer :

Its small, but well documented:

  $ serializer = JMS \ Serializer \ SerializerBuilder :: build (;; & gt; (create) $ Serializer-> Serialize ($ data, 'XML');    

No comments:

Post a Comment