XMLHttpRequest without server feedback [closed] - javascript

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 days ago.
This post was edited and submitted for review 3 days ago.
Improve this question
xht = new XMLHttpRequest();
xht.open("POST", "nload");
xht.send(fg);
Shown code send a POST request to server. "nload" flag signals the server to don´t send data back. This is deliberately want! The flag is self programmed and not official. When strstr(str1, "nload") server don´t send data back. My client (Chrome) print a error because server doesn´t send data back shown in picture.
I tried to use "GET" instead of "POST" and navigator.sendBeacon() but booth has same result.
I looking for solutions to solve the error

Related

Simple question: POST or GET, regarding image upload? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 months ago.
Improve this question
In my backend API, I return information based on an image that a user uploads; ie. the user "gets" data depending on the image they inputted. Should this be a GET request or a POST request?
I was thinking it should be a GET request, but my code only seems to work if it's a POST request (specifically, the backend server only seems to get the inputted image if the request is a POST request).
Thanks!
Use POST Method only to upload files.
GET won't work as it doesn't have body to pass on values/files

User credentials seen in header form data even after using https [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
Passing user credential from Angular to PHP, they are totally visible in developer tools > Network > Headers > Form data, see below image:
I am using Https everywhere but still my credentials are seen in plain text.
What am I doing wrong?
There are 4 ways to "hide" parameters from appearing in the developers tools:
1st (weakest) encode it
Depending on the algorithm, the data is unreadable afterwards but can easily be decoded to the plaintext
2st Hash the data
The data is unreadable afterwards but you cannot read it yourself too.
3rd Encrypt data
Requires passwords / keys to be sent, leaving you with a dilemma.
4th and probably strongest: Don't send the data at all
Store the secret on the server and link it to the public session id.

Difference between Ajax return Response function and only return [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
What is the difference between having the following in an ajax request / call (is it request or call?)
return $output;
and
return Response($output);
both work, but Response does not give me information about the returned element while return only does give me information.
AJAX is a call actually but as we are requesting to server for send us response against some query that's why we call it AJAX request.
I'm not so sure but Reponse($output) in PHP yields you the modified response from server, by modified response I mean the filtered information to your request and response($output) gives the whole body of response coming from Back end.

How to get and pass the key in another API in Postman [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I have an application wanted to implement this scenario in Postman - where i have to create and get the Key and pass the same key to another API to delete
Usually you have an endpoint to generate your key, like a login post request which returns your user information and token.
Do you have something like that? Let me show you how this could be done:
After that you get this key/token and use it in the Header tab to send this value in your next request. Something like this:
When you get the token/key in your response body of the first request, set it into an environment variable in Tests section like this.
var body = JSON.parse(responseBody);
postman.setEnvironmentVariable("AccessKey", body[accessKey]);
After that you can use it in your next request URL as
http://your-api-endpoint/{{AccessKey}}

Is there a way to get the GET Request URL using JavaScript? (not current URL in the browser) [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I want to check if I can read HTTP GET Request URL using JavaScript, but not the current URL.
For example: when I open https://stackoverflow.com/ in my browser and run a chrome network debugger (or any packet sniffer) we see all the requests as shown below.
Here is a sample HTTP Header for reference: I would want to check if I can capture Request URL using JS.
Remote Address:54.243.183.124:80
Request URL:http://l.betrad.com/ct/0_0_0_25650/us/0/1/0/0/0/0/220/250/242/343/0/pixel.gif?v=78f7264&ttid=2&d=view.atdmt.com&r=0.579902658239007
Request Method:GET
Status Code:204 No Content
Request Headersview source
You can access the url using location.href. You can get the length of it as simply as
var length = location.href.length;

Categories