Post normal http url with get and put


#1

I saw sample with Ajax on nsbasic but it does not work normal http post and get. I really really really want to do just basic post and get http. I had web http written in the back as Delphi and C++. Been trying for months without success.


#2

It’s difficult to help if you don’t tell us what you try and what actually happens.

http://www.catb.org/esr/faqs/smart-questions.html


#3

I copy this code for sending data to normal CGI Http to get response back

Function Button1_onclick()
Dim req
req=Ajax(“localhost:8080/?code=”&TextBox1.value)
If req.status=200 Then 'success
TextBox1.value=req.responseText
Else 'failure
TextBox1.value="Error: "
End If
End Function

and on Delphi side I just write back the response

procedure TWebModule1.WebModule1DefaultHandlerAction(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
begin
Response.Content := ‘Return data:’+Request.QueryFields.Values[‘code’];
end;

it works in a normal browser just return what is type in as parameter and back
as http://localhost:8080/?code=22394929 but it didn’t return anything.
Perhaps NSBasic users who also know or use Delphi could tell me what is missing.


#4

Have a look at what is being returned in req on failure. Is there an error message of some sort?


#5

I got the same error same as another upcoming post of Error Undefine for AJAX.


#6

Check out the response here: