jquery ajax post with params -



jquery ajax post with params -

i need upload file using jquery's $ajax function, besides uploading file, want able tell folder/directory filed uploaded to. tried next won't work:

info = new formdata() data.append('csv', filedata) $.ajax cache: false contenttype:false processdata: false type: 'post' datatype: 'script' url: '/api/upload/' params: ['test'] <-- folder/directory want upload data: info complete: (res) => if not (res.status 200) console.log(res.responsetext) homecoming false else homecoming true

the api worked fine, when check request showed params empty:

params: [] query: {}

how can pass parameter ajax post? thanks

you can add together additional param formdata

data = new formdata() data.append('csv', filedata) data.append('path', 'my/path')

there no alternative called params in $.ajax()

jquery ajax post

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -