skip to main | skip to sidebar

how to post data using jquery php

Here you will find a free php scripts, php resources, php tutorials, web resources , jquery

<?php print "welcome to source world-php ajax script"; ?>

WHAT IS JQUERY?

JQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development.jQuery is designed to change the way that you write JavaScript.

If you want to do some kind of ajax then it is very easy with jquery ajax({ });
all you have to do is post your required data to your script file(php,asp,jsp any) and process the data and retrive the data from the server.

Here in this example what I have done is with using jquery jquery ajax({ }); method display a data from scrip file server.php.


Full Html Example with ajax request

<script type="text/javascript">
 var $n = jQuery.noConflict(); //prevents jquery conflict
 $n().ready(function() { 
 
 $n("#btn_postdata").click(function() {
 
 var str = "name=nikunj&age=22"; //pass post data to server.php 
 $n.ajax({
 type: "POST", //send data using post method
 url: "server.php", //this is post data to server.php
 data: str,
 success: function(msg){
 alert(msg); //this is return data from server.php
 }
 });
 
 }); 
 });
 </script> 
 
 

Download Example


Download

Buy Me a Beer-If you are like this post

If you does not have paypal account create free account create account

No comments:

Post a Comment

[フレーム]

Subscribe to: Post Comments (Atom)
 

AltStyle によって変換されたページ (->オリジナル) /