Wednesday, 31 October 2012

how to refresh particular div tag content without reloading page using jquery?

// Note : First include jquery.js file.....
<script type="text/javascript">
var auto_refresh = setInterval(
function ()
{
$('#load_div').load('load.php').fadeIn("slow");
}, 100000); // refresh every 10000 milliseconds
</script>

//index.php

<div id="load_div">
</div>

//load.php

In this page you can write your code.
like load randam user,image etc....

Tuesday, 23 October 2012

How to pass data from one domain to another domain(cross domain) using json?‏

//Javascript code

<script type="text/javascript">

$(document).ready(function()
{

var surl =  "http://www.example.com/json.php";

email_id=document.getElementById("email").value;

$.ajax({
url: surl,
data: {email:email_id},
dataType: "jsonp",
jsonp : "callback",
jsonpCallback: "jsonpcallback"
});
});

function jsonpcallback(rtndata)
{
document.getElementById("disp_data").innerHTML=rtndata.message;
}

</script>

//json.php file code

<?php

$display="<b>HI Json</b>";

$display.="<p>HI This is testing json.</p>";

$rtnjsonobj->message = $display;

echo $_GET['callback']. '('. json_encode($rtnjsonobj) . ')';

?>

Tuesday, 16 October 2012

error page using htaccess file

first create .htaccess  file and save it.

then write below code

ErrorDocument 404 /404.html

 

here

404 means when page not found then it occurs

404.html means that page which you want to display.