Jump to content

prkj

New Members
  • Posts

    4
  • Joined

  • Last visited

prkj's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Sorry about that.. i know that it is JQuery but, thinking about AJAX call i typed it. I am a newbie to web development(AJAX too) i am going step by step. I tried to write the call back inside success function, but, couldnt make it work..I havent written any AJAX before..could you please help me writing the Call back in the success function.Thanks alot for your help
  2. "On click fire off first ajax call, in the callback response you could then fire the second request." I dont know how to accomplish this...please help
  3. i tried using ajax for one of those functions. i used the below code,, instead of my php file 1 <script type="text/javascript"> $(function(){ $('form').submit(function(event){ event.preventDefault(); window.location = $('input[type=radio]:checked').val(); }); }); </script> but, if i do event.preventDefault() the form is not going to my php.. I need to do these two tasks by hitting the submit button 1) change the url according to the radio button selection 2) run the php script to save the form data Please help me with this.. Thanks
  4. Hello all, I am trying to call two functions onclick of a submit button. the two functions inturn go to two php scripts..i want the php scripts to be run one after the other. But, its not working. Please take a look at my code and suggest some changes my html : <form method="post" action="" name="form"> <label> New Data set: </label> <input type="radio" name="url" value="NetOptInput2.html" id="ex1" required/> Yes <input type="radio" name="url" value="NetOptResult2.html" id="ex2" required/> No <br><br><br> <label>Dataset description: </label> <input type="text" name="dataset" id="field1" size="30" placeholder="" readonly><br><br><br> <label>Token Number : </label><input type="text" name="token" id="field2" size="6" placeholder="" readonly><br><br><br> <div style="text-align: center"><br> <input type="Submit" name="submit" value="Submit" class="submit" onclick="return(OnButton2() && OnButton1())"> <div class="spacer"></div> </form> My Javascript <!-- this function navigates user according to the radio button selection--> <script language="Javascript"> function OnButton1() { document.form.action = "Input1a.php" // document.form.target = "_blank"; // Open in a new window //document.form.submit(); // Submit the page // return true; } function OnButton2() { document.form.action = "Input1b.php" //document.form.target="_blank"; // document.form.submit(); // Submit the page // return true; } <!--This function disables the Token Number form if the user clicks "yes" radio button and disables Dataset if "No"--> <script type="text/javascript"> $(function(){ $("#ex1, #ex2").change(function(){ $("#field1, #field2").val("").attr("readonly",true); if($("#ex1").is(":checked")){ $("#field1").removeAttr("readonly"); $("#field1").focus(); } else if($("#ex2").is(":checked")){ $("#field2").removeAttr("readonly"); $("#field2").focus(); } }); }); MY php file1 if (isset($_POST) && $_POST['url1'] == "Yes") { header('Location: NetOptInput2.html'); } else if (isset($_POST) && $_POST['url2'] == "No") { header('Location: NetOptResult2.html'); } my php file 2 if (isset($_POST['submit'])) { $dataset = $_POST['dataset']; $tokennumber = $_POST['tokennumber']; $data = "$dataset | $tokennumber\n"; $file = "input.txt"; $fp = fopen($file, "w") or die("Couldn't open $file for writing!"); fwrite($fp, $data) or die("Couldn't write values to file!"); fclose($fp); $message = "Saved to $file successfully!"; }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.