Posterous theme by Cory Watilo

Filed under: Jquery

jQTouch

Yesterday, I'm testing jqtouch. Wow... It's great. I'm starting iPhone Development with PhoeGap. It's easy and fast development. I don't need to read iPhone SDK and I can development quickly with jquery. So, I searching iPhone UI with jquery because phonegap is not support native UI. I want native UI. It's nice and most of the people love it. I found jquery Iphone UI. It' not good. It design with iPhone Screen. So bad. Can't use in Web Design for iPhone Safari. So, I searched new jquery and I found and I love it. It's jQTouch. I found it and I said wow.... amazing....

Read the rest of this post »

Add jquery built in apiwork

haha. I add jquery for default. Here, I use in my view like this

<html> 
<head> 
<?php 
/* add script from code.jquery.com $this->jq->get_latest(); */
 //you can also load like this $this->load->js('jquery');
$this->jq->noconfilt=true //for jquery no conflit 
$this->jq->get_script(); 
?> 
<script> 
<?php $this->jq->start_jq(); ?> 
 alert("I'm jquery"); 
 <?php $this->jq->end_jq(); ?>
</script> 
</head> 
<body>  </body> 
</html> 

Ornagai Dictionary with Jquery + JSON

Today, I am making ornagai dictionary with jquery. I was thinking about at 7:00 at English Tuition. At 12:00 pm, I was staring the code for that. It was complete in a half hour. However, it's using 20 KB JSON file. So, I thought it, "Can I do complete dictionary in one JSON file ? " I export the JSON from mysql database. It had 4 MB. And then run in my code. Oop!!! My firefox had been hung. I restart my firefox and changing my code. I will show just 9 results and try again it. It was ok but too long to wait. So, I decided to make index the JSON. I made a.json to z.json and then search again. Amazing... I said "Awesome!!!" It's so fast and unbelievable searching. I love jquery and JSON. I finished that project just in 2 hours. You can download JqueryDict in there. I am thinking about Myanmar to the English dictionary with JqueryDict but it should make many indexs for ka to arh. So, I will do when I have a free time.

 

Cheer!!!

Ajax Search When textbox change (JQUERY + PHP)

It can make easy with jquery and php. Jqueyr also include ajax function and we can make easily that. First download jquery file from www.jquery.com. I made search.html and code is follwoing.

searching.html

[sourcecode lang="xhtml"]<html>
<head>
<title>AJAX Search Simple</title>
<script src="jquery.js"></script>
<script>
$(document).ready(function() {

    $("#q").keyup(function(event){
        value=$(this).val();
        $("#result").html("<b>Searching...</b>");
        $("#result").load("result.php?data="+value);
    });

});
</script>
</head>
<body>
<input type="text" id="q">
<div id="result"></div>
<body>

</html>[/sourcecode]

I am using keyup function for id q. ( #q mean id q that is textbox ) After keyup get value from text box and write text searching in result (div). I send query string to result.php. You will see result.php is following

result.php

[sourcecode lang="php"]
<?php
//You can write some code in there.
//Connect Database and make sql query in here
echo "Search For ".$_GET['data'];
?>[/sourcecode]

You should add some code in PHP for search in database. It's a simple. You can download complete code in here.

Json with Jquery

Today, I am think about ornagai api. I should export with JSON because json is easy to read data with javascript library (mootools,jquery,etc..) and also with PHP. So, I tring with Jquery to read json. Oh! it's so easy and so nice for me.

This is a data.json

{
"data":
[{
"word":"A",
"state":"art",
"def":"     the first letter of the English alphabet"
},
{
"word":"Art",
"state":"n",
"def":"the quality, production, expression, or realm, according to aesthetic principles, of what is beautiful, appealing, or of more than ordinary significance"
}
,
{
"word":"Saturn",
"state":"n",
"def":"an ancient Roman god of agriculture, the consort of Ops, believed to have ruled the earth during an age of happiness and virtue, identified with the Greek god Cronus."
}]

}

This is my jquery code

[sourcecode lang='js'] $(function() { $.getJSON("data.json", function(json) { alert(json.data[1].def); $.each(json.data,function(i,mydata){ $("#result").append(mydata.word+"<br>"); }); }); }); [/sourcecode]

Complete HTML code is

[sourcecode lang='xhtml'] <html>
<head>
<script src="jquery-1.3.2.min.js"></script>
<script>
$(function() {
$.getJSON("data.json", function(json) {
alert(json.data[1].def);
$.each(json.data,function(i,mydata){
$("#result").append(mydata.word+"<br>");
});
});
}); </script>
</head>
<body>
<div id="result">
</div>
</body>
</html> [/sourcecode]

Download Complete source code