Tag Archives: json

Convert .xsd file into array in PHP

As we know that PHP has no direct function to convert .xsd(XML Schema Definition) file into associative array like XML file. So you have to  first convert .xsd file into xml then finally parse xml file into associative array. Below are few easy steps to convert .xsd file into associative array.   $doc->preserveWhiteSpace = true; $doc->load(‘yourfile.xsd’); Step 2: Save .xsd file as an xml file. $doc->save(‘myxml.xml’); Step 3: Generate xml as a string and removed xsd prefixes. $myxmlfile = file_get_contents(‘myxml.xml’); […]

Parse JSON, XML and HTML – jQuery

In this post, find out jQuery code on how to parse JSON, parse XML and parse HTML. If you are still using custom code for parsing any of these and making your life more miserable then stop doing it. Why? If you are not aware then here is a news for you that jQuery has inbuilt utility methods for each. Which are, parseJSON() parseXML() parseHTML() Using parseJSON() This method takes a well-formed JSON string and returns the resulting JavaScript object. […]

Compress JSON data

JSON is good data format to grab some server side data through an AJAX call. For example by using jQuery.ajax method. In PHP, to provide data in JSON format in super simple. However, when the data is large, do you know any ways to compress the data to facilitate for fast transmission. JSON – JavaScript Object Notation Here is a simple tutorial to introduce how to use format data in JSON format in PHP. First, you need to set the […]

jQuery.ajax() More Usefull Then jQuery.Post()

jQuery.ajax() More Usefull Then jQuery.Post()

Well, as you are aware that there are many ways to make an ajax call. So 2 very common ways are jQuery.Post() and jQuery.get().jQuery post() is for to make a post request and jQuery get() is to make a get request. That’s the only difference between jQuery Post() and jQuery get(). These methods are very popular for ajax call because they are simple to write and easy to remember the syntax as well. But you are making a mistake over […]