• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

How to submit data with URL which is self redirecting using ajax?

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Basically I am trying to add the data which submitted in url for eg /job_status.php?job=XXXX&email=YYYY.

I also tried append the url inside ajax block url: "job_status.php?job="+TaskNumber+"&email="+email . but it didn't work out

<?php
       error_reporting(0);

       $title = "Job Status Updates";
       ?>
       <?php include_once 'header.php'; ?>
       <div class="container" style="width: 860px;">
           <h1 style="text-align: center;">Order Status and Job History Portal</h1>
           <div class="panel panel-primary" style="margin-top:20px;">
               <div class="panel-heading">
                   <h3 class="panel-title"></h3>
               </div>
               <div class="panel-body">
                   <p style="font-size:17px;">To find the current status of your order, please fill in your job # (i.e N123456) and email address associated with this job.</p>
                   <form name="taskStatus" action="job_status.php" method="post" class="form-inline" id="taskStatus">
                       <div class="row">
                           <div class="form-group">
                               <div class="col-md-6">
                                   <input type="text" class="form-control" id="TaskNumber" name="TaskNumber" placeholder="Job #" required style="width: 100px;" />
                               </div>
                           </div>
                           <div class="form-group">
                               <div class="col-md-6">
                                   <input type="email" class="form-control" id="email" name="email" placeholder="Email" required style="width: 350px;" />
                               </div>
                           </div>
                           <div class="form-group">
                               <div class="col-sm-2">
                                   <button type="submit" class="btn btn-primary" id="submitQuery">Find Order Status</button>
                               </div>
                           </div>
                       </div>
                   </form>
                   <br />
                   <div id="response"></div>
               </div>
           </div>
       </div>
       <div id="history"></div>
       <script type="text/javascript" src="./js/jquery-1.11.1.min.js"></script>
       <script type="text/javascript" src="./js/bootstrap_3.3.2.min.js"></script>
       <script src="js/jquery.form.js" type="text/javascript"></script>
       <script src="js/blockui.js" type="text/javascript"></script>
       <script type="text/javascript">
           //$(document).ajaxStart($.blockUI).ajaxStop($.unblockUI);
               $(document).ready(function () {

                   var a = $(this).attr("TaskNumber");
                   var cID = $(this).attr("email");
                   $.ajax({
                            type: "GET",
                            url: "job_status.php", //self redirecting url
                            data: {val: a, cID: email}

                         });
                   var taskoptions = {
                       //target: '#response', // target element(s) to be updated with server response
                       url: 'job_status_action_local.php',
                       success:    function(data) {
                           obj = eval("(" + data + ")");
                           $("#response").html(obj.response);
                           $("#history").html(obj.history);
                           $.unblockUI();
                       }
                   };

                   $('#taskStatus').submit(function () {
                           $.blockUI({ css: {
                           border: 'none',
                           padding: '15px',
                           backgroundColor: '#000',
                           '-webkit-border-radius': '10px',
                           '-moz-border-radius': '10px',
                           opacity: .5,
                           color: '#fff'
                       } });
                       $(this).ajaxSubmit(taskoptions);
                       return false;
                   });
               });
       </script>
       <?php include_once 'footer.php'; ?>
 
Rancher
Posts: 4190
47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What errors are you getting?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!