PHP - Moved: Ajax Request Not Working In Ie
This topic has been moved to Ajax Help.
http://www.phpfreaks.com/forums/index.php?topic=322771.0 Similar TutorialsThis topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=347835.0 This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=354053.0 hey guys im tring to look for a good way of finding out if a ajax request is being performed on my page...now ive had a look about and found these two snippets.
Both seems to work fine...any suggestions on what one is best to use or even if there is a better way to do this would be helpful...thank you
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === "xmlhttprequest") { // is ajax } if (strpos($_SERVER['HTTP_ACCEPT'], 'application/json') !== false){ // is ajax } This part of the question is based off of php so I'll put it here of course. The idea behind this is jquery/ajax is going to get passed an id (eventid) from a dropdown select box inside a form and it's going to run a query to find all the events in my database with that same id. After running the query it's going to list them out and find the highest number of another field (label) and its going to add one to its value and then what I would like for it to is send it back to the form in the jquery/ajax and and place that label inside of the existing input text field in the form. So I'm asking is if my code is presented and is doing what I"m attempting it to do on the php side and if so if I can take out the print tag of the input text field. $eventid = $_GET['eventid']; $result = mysqli_query("SELECT * FROM `events` WHERE `event_id` = '$eventid'"); $list = mysqli_num_rows($result); $label = $list + 1; print '<input type="text" name="label" class="text" readonly="readonly" value="' . $list . '" />'; Hi, I would like to send a value in a link and request it back in ajax and set it as a variable in php in the same page, can anyone help me here? thanks /*I'm trying to use dropzone js plugin for drag/drop single phote but it require me to create another form for file upload, but i want to use single form for both image and name input, i have no idea on how to combine this field in sinle request, the form to submit both image and name look like*/ <form method="POST" enctype="multipart/form-data"> <input type="text" name="name" id="name"> <!--how to replace this field with dropzone but in this form in order to use the same ajax as below--> <input type="file" name="photo" id="photo"> <button type="submit">send</button> </form> //ajax, how to add dropzone data in $("form").on('submit', function(e) { $.ajax({ url: 'add.php', type: 'POST', data: new FormData(this), dataType: 'JSON', contentType: false, cache: false, processData:false, }).done( function (data) { if(data.success == false) { //for error message response if(data.errors.name) { $('#name').append('<span class="text-danger">' + data.errors.name + '</span>'); } if(data.errors.photo) { $('#photo').append('<span class="text-danger">' + data.errors.photo + '</span>'); } } }); e.preventDefault(); });
Hello forum,
So I've been developing an app mostly in PHP, but am rather afraid of JS. Hope to fix that.
I have an AJAX dropdown using JQuery to search locations. It works great. However, I want to make it similar to what is seen on this site:
http://placefinder.com/
As you can see, the dropdown, when clicked populates a box. Then the user submits the form and the data is used in the application.
I have no clue how to make the form populate with data from the DB (I'm using mySQL) when clicked. So far, I've only been able to make it clickable as a URL (not what I want, obvioiusly!)
Is there a way to do this on a really small, simple script for starters? I'm certain their is, but don't even know where to begin.
Any help appreciated
Hi guys, Im trying to work with a wsdl which allows me to login and sends back a token (cookie) in the response. Whenever I strip out the token and the use __setCookie to set the cookie for future requests all other requests will not authenticate... Anyone any ideas please? Im really at a loose end... Heres the code Im using... Code: [Select] <?php ini_set("soap.wsdl_cache_enabled", "0"); $url = "some.wsdl"; //$url = "http://ws.some.com/services/some?wsdl"; $soap = new SoapClient($url, array('trace' => true)); // try 3 times to login for($i = 0; $i < 3; $i++){ try{ $result = $soap->opLogin(array('name' => 'username', 'cleartext' => 'password')); $token = $result->info; $token = trim(str_replace("PubAuth1=", "", $token)); // Print token echo "token - cookie:"; print($token); echo "<br>"; // Set cookie //$soap->__setCookie('PubAuth1', $token); createSession(); // Retry loopje for($i = 0; $i < 3; $i++){ try{ // This is the second call which will not authenticate.... $result2 = $soap->__soapCall("opSetUser", array("email" => "me@you.com", 'p' =>'password123')); // Print result echo "opSetUser result: "; var_dump($result2); exit; } catch(Exception $ex){ echo "opSetUser error: " . $ex->getMessage() . "<br>"; } } } catch(Exception $ex) { echo "opLogin error: " . $ex->getMessage() . "<br>"; } } ?> THanks in advance. Davy This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=359184.0 Hello Everyone So i have this script that pulls some stuff out of a db and displays it. Pretty basic. It used to work fine but now it omits one entry from the table. It always shows one less than its supposed to. I.E. if there are 4 table entries, it only shows 3. It didnt do this before and I'm not sure why it changed. I didnt edit the code at all. Here it is: Code: [Select] else{ $sql = "SELECT * FROM article WHERE lang='" . $validlang ."' AND cat_id=" . $validentry . " ORDER BY id DESC LIMIT 5"; $result = mysql_query($sql); if(!$result){ echo "Error querying the database." . mysql_error(); exit; } else{ $row = mysql_fetch_assoc($result); } if(!$row){ echo "Error: No articles found." . mysql_error(); exit; } else{ echo "<div id='section'>Organization News</div>"; while($row = mysql_fetch_assoc($result)){ echo "<h3><a href='" . $validlang . "/" . $row['location'] . "'>" . $row['title'] . "</a></h3>"; echo "<div id='subtitle'>" . $row['summary'] . "</div>"; } } } Any help would be appreciated. Thanks This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=325858.0 This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=351379.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=333348.0 This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=312841.0 This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=314220.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=314117.0 This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=308756.0 This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=320161.0 This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=332473.0 This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=348693.0 |