• RSS
  • Facebook
  • Twitter

PHP, Mysql, Codeigniter,ruby on rails, fedora,ubuntu,wordpress, Gnome3, HTML5, CSS3, Jquery, GIMP programming.

Sponsored Links

post Json like getJson in Jquery

Sponsored Links

jquery 1.4

In Jquery getJson is a great function. it used to Load JSON-encoded data from the server using a GET HTTP request.  In the server side also we can handle json very easly. In PHP just use json_encode () will do the magic. So ajax transportation using PHP and jquery is easy.

the problem is

PHPVersion  Description

5.3.0       The options parameter was added.

5.2.1          Added support to JSON encode basic types.

I am using codeigniter for small projects. So there is a problem with the GET methode.Code Igniter will suppress the Get requests and parameters. some people saying that using GET is not that much good in the case of security. So I searched a postJson function in Jquery and find nothing. Actually the answer is very simple.

$.post('ajax/test.html', function(data) {
  $('.result').html(data);
});

is a great function. Just turn on the json using

$post('url',function(data) { the result; },"json");

will give the postJson function. Like this

$.post("test.php", { "func": "getNameAndTime" },
   function(data){
     alert(data.name); // John
     console.log(data.time); //  2pm
   }, "json");

Saved My Life. Great..

Amplify

Related Articles:

  1. SimpleModal – A jQuery Modal Dialog Framework
  2. Jparallax – Amazing 3D Effect with Jquery Javascript Library
  3. Code Igniter Image Uploader / File Uploader – Multiple Files
  4. Install Ruby on Rails in Fedora 12 – Ubuntu 9.10
  5. HTML Tutorial – Best Practices for web developers

Related Keys:

  • $.postjson and getjson
  • how to use $.getjson using codeigniter
  • codeigniter jquery json post $.ajax url
  • getjson rails jquery
  • jquery getJSON encoding
  • getJSON+type+post
  • jquery getjson rails
  • jquery json 예제
  • $.postjson
  • android+json+facebook post method
  • codeigniter get json
  • javascript getjson postjson data
  • $.getJSON y $.post JSON
  • jquery postjson example
  • jquery validate getjson
  • codeigniter+jquery+json
  • json for javascript jquery in android
  • $.getjson $.postjson
  • $.postJSON
  • postJSON
  • Codeigniter Jquery post data
  • getjson rails url
  • .getjson rails example
  • getjson android example
  • how we can get the post json parameters in php codelgniter
  • getJSON in jquery
  • postjson rails
  • wordpress getjson
  • getjson post
  • jquery.getjson post
  • json post todo server using jquery
  • android json post form data
  • jquery ajax 예제
  • sample example with $.getjson using codeigniter
  • get 'json', post jquery
  • chained selects jquery plugin json code igniter
  • %24.getJSON+can+i+use+%24.postJSON
  • jquery slider carousel ajax 2011 2012
  • tag any face on photo javascript wordpress
  • jquery postjson
  • jquery postjson examples
  • ajax get json android problem
  • jQuery.postJSON
  • how to get JSON data in jquery
  • jquery postjson form
  • postJson+jquery
  • rails jquery json examples
  • ajax +"postjson" +"spring"
  • $.postjson getjson
  • getjson with codeigniter
  • http://www.x0.org.ua dima

    I use this:

    [code]
    ..........

    <script type="text/javascript" src="/dev/jquery-1.3.2.js"></script>

    <script type="text/javascript" src="/latest/jquery.json-2.2.js"></script>
    .............
    .............
    var formData = {
    "text_cm":$("textarea#text_cm").val()
    , "email":$("input#email").val()
    , "name":$("input#name").val()
    , "validate":$("input#validate").val()

    };

    $.ajax({
    type: "POST",

    url: "/comments_photo/add",
    data:'jsonData=' + $.toJSON(formData),
    dataType: "json",
    success: function(msg) {

    if (msg.success_ok > 0) {
    ........[/code]