get

How to get the URL of a xmlhttp request (AJAX)

╄→гoц情女王★ 提交于 2019-11-29 17:29:04
On w3schools.com (url) there is an example of how to do an AJAX call with plain Javascript. If you look at the example you will see the call is triggered by a button: <button type="button" onclick="loadXMLDoc()">Change Content</button> This is the function: function loadXMLDoc() { var xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById(

SSL Error on Python GET Request

▼魔方 西西 提交于 2019-11-29 17:28:46
I am trying to do a simple GET request to this url: link Here's the basic python code which I already use for other urls and works. url = 'http://www.bbvafrances.com.ar/francesGo2-Portal/institucional/busqueda.do?m=&page=1' r = requests.get(url) print r.text The thing is that with this particular url I get an SSL error: Traceback (most recent call last): File "frances.py", line 134, in <module> r = requests.get(url,verify=False) File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 55, in get return request('get', url, **kwargs) File "/usr/local/lib/python2.7/dist-packages

Prevent browser waring when you hit the 'go back' button after form submit

只愿长相守 提交于 2019-11-29 17:16:50
I have a little problem here. Actually, more of an annoyance. I have a form on my index page that has a small search form: <form action="search.php" method="post"> <input name="search" type="text" /> <input type="submit" name="submit"> now on the search.php file I just use the $_POST['search'] to retrieve the value that I'm searching. This file also displays the actual search results, which I can click on to go to that page.The search is actual done on the database. Also, because my search returns the top 10 random results from the DB, if I hit the 'back' button and confirm the warning, the

How to send data in request body when using Typeahead & Bloodhound?

不羁岁月 提交于 2019-11-29 16:56:39
I'm trying to implement a typeahead whose source is an API that expects a GET request with a body of data, not url encoded data. I've tried a few different things in the 'prepare' object, but can't get it to url encode parameters. Is it possible with typeahead, or jquery in general, to have it not do this? I have a feeling jquery maybe just doesn't let you do this, since it would be considered 'bad practice', but changing the API is not really an option! Here is my code: $(document).ready(function(){ var people = new Bloodhound({ datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),

passing variable between pages

吃可爱长大的小学妹 提交于 2019-11-29 16:52:06
Is it good way to pass variable between pages using $_GET method with url: <a href="input_obj.php?id='$id'&method=plain and take it in file input_obj.php with such code: $id = $_GET['id']; $method = $_GET['method']; OR using session - has someone idea how? It depends on your needs, really, If you are passing search arguments between pages, for example, and the variables should be both persistent and be available to the end user (via bookmarking, for example), then pass them in the URL (but don't usually use quotes like you have around $id in "input_obj.php?id='$id'&method=plain ) If you are

I can't use GET and POST at the same time in PHP

邮差的信 提交于 2019-11-29 16:19:22
Near the top of my page, I have this: <?php $id = $_GET['id']; ?> Then I have some form check conditionals that read from POST: if (isset($_POST['completeSubmit'])) { //code } And finally, I have an HTML form which looks like this: <form action="<?php echo $_SERVER['PHP_SELF']."?id=$id"; ?>" name="complete" method="post"> <input type="submit" id="textButton" name="completeSubmit" value="[mark as complete]"> </form> The page is initially accessed by using GET with an id variable like this: http://website.com/page.php?id=1 All subsequent form submissions (which get redirected to the same page)

How to grab URL parameters using PHP?

℡╲_俬逩灬. 提交于 2019-11-29 16:14:58
I'm trying to grab each URL parameter and display them from first to last, but I want to be able to display any of the parameters anywhere on the page. How can I do this? What do I have to add or modify on my script? Here is an example of a URL value. http://www.localhost.com/topics/index.php?cat=3&sub1=sub-1&sub2=sub-2&sub3=sub-3&sub4=sub-4 Here is my PHP script. $url = $_SERVER['QUERY_STRING']; $query = array(); if(!empty($url)){ foreach(explode('&', $url) as $part){ list($key, $value) = explode('=', $part, 2); $query[$key] = $value; } } You don't need to do that manually, PHP already

How to set cookie secure flag using javascript

故事扮演 提交于 2019-11-29 15:59:36
问题 I have tried to set a cookie using document.cookie = "tagname = test; secure" but this does not set the secure flag. Am I setting it wrong? Can you only set it from a server response? I am also wondering that, because I have had a difficult time finding an example of its use, that it probably is not commonly used? Thanks a bunch! 回答1: TL:DR document.cookie = "tagname = test;secure"; You have to use HTTPS to set a secure attribute The normal (or formal, maybe) name is attribute. Since the flag

How to execute a https GET request from java

北慕城南 提交于 2019-11-29 15:38:14
问题 I wrote a Java client which executes http GET requests without any problem. Now I want to modify this client in order to execute https GET requests. import org.apache.http.HttpHost; import org.apache.http.auth.AuthScope; import org.apache.http.auth.UsernamePasswordCredentials; import org.apache.http.client.CredentialsProvider; import org.apache.http.client.config.RequestConfig; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import

Cannot send content-body with GET request

試著忘記壹切 提交于 2019-11-29 15:18:13
I am trying to execute a simple "request body search" on Elasticsearch like the following example but using .NET instead of curl $ curl -XGET 'http://localhost:9200/twitter/tweet/_search' -d '{ "query" : { "term" : { "user" : "kimchy" } } } ' Below is my .NET code. var uri = "http://localhost:9200/myindex/_search"; var json = "{ \"query\" : { \"term\" : { \"user\" : \"kimchy\" } } }"; var request = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(uri); request.ContentType = "text/json"; request.Method = "GET"; var responseString = string.Empty; using (var streamWriter = new System.IO