linb / CrossUI

CrossUI is a free Cross-Browser Javascript framework with cutting-edge functionality for rich web application
https://crossui.com
MIT License
1.87k stars 38 forks source link

Ajax problem #49

Closed indianajava closed 3 years ago

indianajava commented 3 years ago
  1. xui.Ajax with options.method = 'POST' always send as GET
  2. xui.request can not upload file, because automatically use xui.Ajax instead of xui.XDMI
linb commented 3 years ago

Did you try: xui.request(uri, query, onSuccess, onFail, null, {proxyType:"ajax", method:"post", data:{...} }) or xui.request(uri, query, onSuccess, onFail, null, {proxyType:"fetch", method:"post", data:{...} })

indianajava commented 3 years ago

in previous version (2.40), this code working properly to upload file: xui.request(uri, query, onSuccess, onFail, null, {method:"post"})

also happen at https://www.crossui.com/RAD/index.html, with image component, try to upload picture from image selector, it doesn't work

linb commented 3 years ago

In 3.0+, you have to add the file in data object. xui.request(uri, query, onSuccess, onFail, null, {proxyType:"ajax", method:"post", data:{ "file":xxx } }) or xui.request(uri, query, onSuccess, onFail, null, {proxyType:"fetch", method:"post", data:{ "file":xxx } })

indianajava commented 3 years ago

fetch is new feature in 3.0, what different between fetch and ajax ?

linb commented 3 years ago

The Fetch API is a modern interface that allows you to make HTTP requests to servers from web browsers.

Only works for ES6+, and it's a recommended way to replace ajax.

On Tue, Mar 2, 2021 at 7:37 PM indianajava notifications@github.com wrote:

fetch is new feature in 3.0, what different between fetch and ajax ?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/linb/CrossUI/issues/49#issuecomment-789329804, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA63GPTB3ORGKVYMA3DQ45LTBWAGHANCNFSM4YLFZBBA .

indianajava commented 3 years ago

oh thks