$,ajax vs $.post - $.ajax data format causing error

$,ajax vs $.post - $.ajax data format causing error

Hi,

Need explanation of where I'm going wrong. I have to process the var str to properly call $.ajax but don't know how. See Source below to see value of str.

  1.     var str=$("#imageForm").serialize()+"&recId="+recId;

    var request = $.ajax({  // get data from database
        url: "revise.php",
        type: "POST",
        data: str,                      // wrong way here, I think
        dataType: "json"         
    }); // ajax

    request.done (updatedData);
            
    request.fail(function( jqXHR, textStatus ) {
        alert("Bad Request!! revised.html 145 See Firebug");      
    });

The above causes error.


  1.     var str=$("#imageForm").serialize()+"&recId="+recId;


     
            $.post("revise.php",str, "json"),                  // this works ok
                function updatedData(retData) {                 
                    $.each(retData[0], function(key, value) {
                        $("#"+key).val(value);
                    }); // each         
             }; // updated
             //successMsgShow();             
        }; // update

Here is the output from firebug when $.post is called.


POST http://mydb.com/pollywood/queries2.php
   
200 OK
        1ms   
jquery-1.9.1.js (line 8526)
POST http://mydb.com/pollywood/revise.php
   
200 OK
        32ms   
jquery-1.9.1.js (line 8526)
HeadersPostResponse
Parametersapplication/x-www-form-urlencodedDo not sort

askPrice 32
dateToVendor 2016-08-02
filename img 9087
imageName Garden Bee
imageSize 8x10
itemNo 12
note   
recId 1
timestamp 201608081105
vendor    isaws

Source

itemNo=12&timestamp=201608081105&filename=img+9087&imageName=Garden+Bee&imageSize=8x10&askPrice=32&vendor=isaws&dateToVendor=2016-08-02&note=&recId=1