Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using Blobstore Python API with ajax

there is any sample showing how to use the blobstore api with ajax?

when i use forms works fine, but if i use jquery i don't know how to send the file and i get this error:

    blob_info = upload_files[0]
    IndexError: list index out of range

I have this code in javascript

function TestAjax()
{
 var nombre="Some random name";
 ajax={
    type: "POST",
    async:true,
    //dataType:"json",
    url:"{{upload_url}}",
    data:"nombreEstudio="+nombre,   
    error: function ()
    {
        alert("Some error");
        $("#buscando").html("");
    },            
    success: function()
             { alert("it's ok") }
 };             
 $.ajax(ajax);
}

When i use forms the file it's sended with a input tag (exactly like the doc's sample)

like image 956
Kristian Damian Avatar asked Jun 11 '26 23:06

Kristian Damian


1 Answers

I wrote a series of posts about exactly this.

like image 187
Nick Johnson Avatar answered Jun 13 '26 16:06

Nick Johnson