sábado, 6 de septiembre de 2014

como pasar parametros el atributo data en ajax

http://stackoverflow.com/questions/15576548/jquery-how-to-pass-parameters-in-get-requests
http://stackoverflow.com/questions/3066070/using-jquery-to-make-a-post-how-to-properly-supply-data-parameter
Como enviar en formato value1=value1 &value2=value2...
http://stackoverflow.com/questions/9328743/sending-multiple-data-parameters-with-jquery-ajax

how to sent json parameters mediante el metodo get con ajax jquery
http://stackoverflow.com/questions/10948233/jquery-send-json-object-using-get-method
http://stackoverflow.com/questions/10948233/jquery-send-json-object-using-get-method

RESUELTO EL PROBLEMA DE JSON COMO PARAMETRO GET
http://techbrij.com/pass-parameters-aspdotnet-webapi-jquery
-----------
http://stackoverflow.com/questions/18697034/how-to-pass-parameters-in-ajax-post 
Try using GET method,
$.ajax({
        url: 'url',
        type: 'GET',
        data: { field1: "hello", field2 : "hello2"} ,
        contentType: 'application/json; charset=utf-8',
        success: function (response) {
            your success code
        },
        error: function () {
            your error code
        }
    }); 
You cannot see parametrs in url with POST method

-----
http://stackoverflow.com/questions/249692/jquery-wont-parse-my-json-from-ajax-query
According to the json.org specification, your return is invalid. The names are always quoted, so you should be returning
{ "title": "One", "key": "1" }
and
[ { "title": "One", "key": "1" }, { "title": "Two", "key": "2" } ]
This may not be the problem with your setup, since you say one of them works now, but it should be fixed for correctness in case you need to switch to another JSON parser in the future.
-----------

http://api.jquery.com/jQuery.ajax/
  • data
    Type: PlainObject or String or Array
    Data to be sent to the server. It is converted to a query string, if not already a string. It's appended to the url for GET-requests. See processData option to prevent this automatic processing. Object must be Key/Value pairs. If value is an Array, jQuery serializes multiple values with same key based on the value of the traditional setting (described below).
    $.ajax({
    type: "POST",
    url: "some.php",
    data: { name: "John", location: "Boston" }
    })
    .done(function( msg ) {
    alert( "Data Saved: " + msg );
    });
    **************v2b
    VER el parametro data:
    $.ajax({ async:true, type: "POST", dataType: "html", contentType: "application/x-www-form-urlencoded", url:"ajaxcompleto2.php", data:"anio="+v, beforeSend:inicioEnvio, success:llegada, timeout:4000, error:problemas }); 
    ---
     
    
    
    otro en http://blog.zeion.net/2012/09/14/ejemplo-practico-de-ajax-json-con-jquery/
    pero con post ojo 
    var data = "tarea=1&cedula=" + cedula.id; 
    **************

No hay comentarios:

Publicar un comentario