Error sending JSON via Ajax


Hi, i am sending a JSON stringify via AJAX Post, and the app send an error, this is my code:

Dim i, DBRecords, MyJSON
DBRecords = result

Dim data(recs)
For i=0 To recs-1
MyJSON=JSON.stringify(data) 'If i send it as string i receive the same error
Print MyJSON 'Rigth JSON
MyJSON = JSON.parse(MyJSON) 'if i send it as object same error

req = Ajax(“http://file.php”, “POST”, MyJSON)

If req.status=200 Then 'success
MsgBox(“Confirmation sent.”)
Else 'failure
MsgBox("Error sending " & req.err)
End If

The result: Error sending undefined

how do i have to send the json to my php file?


The message means that req.err has the value undefined.

Add this statement before MsgBox("Error sending " & req.err):


Run it again. Open the Chrome Debugger to the Console window. You should be able to see more about what is being returned in req.

Post normal http url with get and put