JQuery :: Using A Load Function With A Post?
Jul 24, 2009
I am unsure as to how to make this work.
var params = $('form#createAdjForm').serialize();
var url = "<?= $this->url(array('controller'=>'create-adjustment',
'action'=>'index'))?>";
[code]....
View 1 Replies
ADVERTISEMENT
Aug 17, 2010
I want to run an external function outside the post.
This is what I have currently.
On success of the post I want to run the setGrandTotal(); function which will do some calculating for me.
View 1 Replies
View Related
Aug 9, 2010
So what I thought was going to be really turns out to not be working for some reason. I'm setting up a shell for my new site. So I'm just trying to get some of my pages linked together for testing the site flow and feel. I want to do this with javascript (jquery) because when I start passing session data that's how I'll be handling this.
So I have this simple line in my js code...
$('#submit').click(function(){
$.post("plans.html");
[code]....
View 2 Replies
View Related
Jul 30, 2010
I'm a total JS/jQuery newbie, and I'm having a problem using jQuery's load() to POST data to a remote PHP script and rewrite a DIV with whatever the server sent back.
Using a proxy in between, I can see that the JS script isn't sending anything, so I guess there's something wrong in the JS code I send to the browser [code]...
View 1 Replies
View Related
Dec 23, 2009
On a page, I have a javascript json output that is generated through PHP. So, for instance, it would look like this:
Code:
var upny_iniresults = {
// "q_id" : "65977",
// "q_txt" : "What is your favorite genre of Music?",
"q_cdata" : [
And then PHP code that generates the JSON. I loop through a question, scan for the results (survey site) and display it as json data. Works perfectly. Basically, the JSON is important because I have existing functions that work with that data (display survey results of that question/etc)Here's the question.How can I generate the same Json output, so it can be read by my other jquery functions (Created by a previous developer, I am a PHP guy) by using Jquery POST as well as a query string. The idea is something like:
Code:
$.post("create_json_results_for_this_question.php", $("#firstform").serialize());
# Firstform is the name of the form that is submitted.
So, would a jquery POST allow the JSON to load in my browser (which I will activate during a click function) just as my PHP json output works or is there another way? I just want to simulate the same effect, but be able to USE the jquery querystring that I have, which is:
$("#firstform").serialize());
because this lets me return survey results of a previously submitted question.My last q. was too convoluted and I realized my dilemma is just the json output.
View 6 Replies
View Related
Aug 7, 2009
i've got a function which makes a call to the database( via jquery $.post) to check if a username already exists. All the data I get back is fine and both the conditional statment works as intentded. I just can't get the function to return a value to the other function that calls it. Could this be something to do with the scope.
Code:
function checkIfUsername(o)
{
$.post(""+CI_ROOT+"index.php/admin/check_if_username",{
username: username.val()
}, function(data){
if(data.bool == true){
[Code]....
View 4 Replies
View Related
Feb 15, 2011
I have the following code to load some pages into a div using the load function. When I click one of the links though, nothing happens. I have read a couple of books on JQuery and looking at the examples they give, this looks correct so I am at a loss.
[Code]...
View 4 Replies
View Related
Nov 14, 2011
Can the .load() function load .php pages? example: $('#element').load('mynews.php');
View 3 Replies
View Related
Mar 29, 2010
I know that there can be a 3rd argument for Jquery's $post. I want to figure out what the best solution is, for a function, that can be used so we can guarantee that no other jquery functions run until the $post action is completed. I use $post to hit 'vote.php' to submit a vote but I want it to complete this process, and be able to confirm it (Without an annoying alert) so it can properly continue with the process of displaying vote results to the site visitor. I just am not sure what I should do. What is the best idea, just create a function that displays a 'please wait' image that loads for a few seconds and then continue?
View 10 Replies
View Related
May 6, 2009
If I have this:
$.post('/admin/duration', $str, function(data){
var jsonData = eval('(' + data + ')');
return jsonData.TIME;
});
How do I get the return value from the function to use afterwards? I know this must be simple. I'm just not seeing it.
View 1 Replies
View Related
Sep 21, 2011
I have an HTML div that gets filled with the following HTML/javascript code via ajax:
<script
type
=
"text/javascript"
[Code]....
The idea is that when I post the form the response gets loaded back into the same div. This works, but when I use the form to post a file I see the following output from Firebug: $ is not defined
Naturally when I resubmit my form again (for example after incorrect input) the resulting response doesn't get loaded into the div because jquery never setup the ajaxForm method.
View 1 Replies
View Related
Aug 3, 2009
I am looking for some code that will do the following
Form to post any URL to an iFrame and load said URL.
I been told Javascript can do this, but I am also after the form bit as well if possible.
View 1 Replies
View Related
Aug 15, 2011
The post is submitted and returns correctly (confirmed by firebug lite), however the code inside the nested function fails to execute on both IE6 and IE7. Works fine on IE8, everything else.
$ (
"form.add"
).
submit (
function
() {
//code outside of .post function executes successfully
$
.post .....
View 8 Replies
View Related
Mar 22, 2010
I am new to all this but making good progress and having fun in the process. I have written quite a bit over recent weeks (including a few $.post / $.ajax calls) for various sites/applications but this one is really puzzling me. Here is a snippet of code that is causing me problems.
[Code]....
The problem is that execution jumps from line 2 to line 6 ... ignoring the function(data) and I am not sure why. I get the correct value of "team" arriving at the perl script .... and the perl writes the correct json back. I just can't think where else I need to look to debug this - as I said, I have done something similar 5-6 times over the last few weeks - all without a problem. So I am sure I am doing something stupid here.
View 3 Replies
View Related
Jul 27, 2011
I have two forms: register and contact, with action attribute that looks like this:
REGISTER.PHP AND CONTACT.PHP FORMS
<form id="myform" action="submit.php?url=register">
and
<form id="myform" action="submit.php?url=contact">
I would like the jquery ajax function to redirect to the above url parameters so that the forms can get processed in their individual functions.
The SUBMIT.PHP page looks like this:
$url = '';
if (isset($_GET['url'])){
$url = strip_tags($_GET['url']);}
if($url=='register'){
[Code].....
View 2 Replies
View Related
Jul 1, 2010
I'm using the Google AJAX APIs, but some reason google.load works when run through normal javascript, but if I call the method from my jquery ready function it doesn't work. Code and output is below
page.html
<script type="text/javascript">
loadGoogleStuff();
function loaded() {
console.debug("in loaded function");
}
[Code]...
window.loadFirebugConsole is not a function If I comment out line 3 in code.js, the console debug runs okay, so the ready function is running okay. Even though there's a reference to Firebug, the same error occurs in Safari too. Nothing on the page loads.
View 1 Replies
View Related
Jan 21, 2010
I'm integrating a small php form into my website using this:
jQuery
(
"#myID"
)
[Code]....
Everything works fine until I press the submit button. Of course the whole page is beeing reloaded and the submitted POST data is on my webpage but not INSIDE the php-script (which is integrated via "load"). How can I submit POST-data to my myscript.php file?
View 2 Replies
View Related
Oct 23, 2010
I can't seem to get a variable declared from within a post callback, so that I could manipulate my script accordingly. I have delete.php, that deletes an id from a mysql db. If it fails, I want the script to stop and display the error. The .php script echos an "ok" if everything went fine, if not - it echos the error.var abort_error; // set the error variable
$.get("delete.php", { delete: $(this).parent().parent().parent().attr('id') },
function(data){
if(data != 'ok') {
[code]...
View 1 Replies
View Related
Sep 30, 2010
I can't use the value returned by $.post() method out of the scope of success function.
For instance in below example myvar alerted as empty even though var is alerted with a value. Besides, hide does not work in the scope of success function.
View 2 Replies
View Related
May 4, 2010
<script type="text/javascript" src="jquery-1.4.2.min.js"></script>
<script type="text/javascript">
var global_var = false;
function test_func() {
$.post("server.php", function(data){
alert("Data Loaded: " + data);
[Code]...
View 2 Replies
View Related
Apr 21, 2011
I try to create form to subscript a newsletter using plugins and the $.post() function ,but the URL outside the server[URL] to send me an email if it receives the data but it doesn't work,
here is the code <html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
[code]....
View 3 Replies
View Related
Oct 11, 2011
How can I post array of controls through &.post() in jQuery??I have some of checkboxs in my page and declare them like this
<input name="mycheckbox[]" "value="myvalue" type="checkbox">
I can get it works if I using <form> tag with an action="post" and a submit button to post to another php page by using this statement to get all controls in receiver's page _GET['mycheckbox'];I have tried
$.post('ajax/test.php", {checkbox: $
(
'input[name="mycheckbox"]'
)});
[code]....
View 1 Replies
View Related
Dec 6, 2011
I just started using jQuery, but i can't get it working. On the index.php page I want a search form, that post's to search.php. Following next, I want that the html of search.php (which will only be a table with the results), is show into the 'results' div in the index.php.
This is the code im using:
<script type="text/javascript">
/* attach a submit handler to the form */
$(document).ready(function(){
alert("Ok - 1");
[Code].....
The alert's are for debugging, but none of them show's up.
View 3 Replies
View Related
Jan 8, 2011
I have been struggling with a form wizard all day. I'm using jquery stepy (form wizard) along with validation plugin. To cut a long story short, my first step is to get MySQL connection from form controls details. On submit ('next' button) a check is made on an empty hidden control ('hid').
rules: {
hid: {
required: function(){
return checkDBData();
},
messages: {
hid:
{required: 'SQL not available'},
...(etc)...
So, if the function checkDBData passes, false should be returned, so that the form can progress to the next step. If the connection details fail, true is returned so that an error msg is posted.
Here's the checkDBData function:
function checkDBData(){
var host = $('#mysql_host').val();
var username = $('#username').val();
var password = $('#password').val();
var dbname = $('#dbname').val();
$.post("install/sqlcheck.php",
{"host": host,"username": username, "password": password, "dbname": dbname},
function(msg){
if(msg.required == false){
return false;
}else{
return true;
}},
"json"
);
}
The return values don't find their way back to the rules. However, if I hard code false and true to the function...
function checkDBData(){
var host = $('#mysql_host').val();
var username = $('#username').val();
var password = $('#password').val();
var dbname = $('#dbname').val();
$.post("install/sqlcheck.php",
{"host": host,"username": username, "password": password, "dbname": dbname},
function(msg){
if(msg.required == false){
return false;
}else{
return true;
}},
"json"
);
return false; //or return true for testing purposes
}
This works. I assume it's due to the asynchronous nature of the ajax call.
View 2 Replies
View Related
Aug 25, 2010
I am new to Javascript and i'm currently building a site that entails a 'quiz' part where the client selects an option from a radio button. Then they move on to a different page, and so on and so on until a results page where the correct number of questions answered are made into a percentage.I understand that you can use the GET or POST to pass this into the query string and then extract the answers from the query string but I am having trouble implementing this.
View 1 Replies
View Related
Apr 19, 2010
I try to load some contentof the .load() function. this works like a charm. See my code here:
$('#index').load('link.html #content', function() {
$('#index').animate({'opacity':1},site_transition_speed);
show_loader("hide");
[code]....
View 4 Replies
View Related