Thursday, 11 February 2016



you can use this code in the following cases:

1) if you want to save data on submitting form then,
replace onchange=“getSummary2(‘order’)” with onclick=“getSummary2(‘order’)”

2) if you want to save on key up then,
replace onchange=“getSummary2(‘order’)” with onKeyUp=“getSummary2(‘order’)”

3) if you want to save data on change then use the code as it is


---------------------------------------------html code-------------------------------------------------


----------------------------------------------------------------------------------------------------------
------------------------------------------javascript.js--------------------------------------------------
function getSummary2(pass)
{
var	id = document.getElementById("sp_order"+pass).value;
	//alert(pass);
   $.ajax({
     type: "GET",
     url: 'sp_orders.php',
     data: "order=" + id + "&&section_id=" + pass, 
// appears as $_GET['id'] @ your backend side
     success: function(data) {
           // data is ur summary
        //  $('#order').html(data);
		     }

   });

}

-------------------------------------------------------------------------------------------------------------
-----------------------------------------sp_orders.php---------------------------------------------------
include('connect.php');
 $timestamp_complete = date("Y-m-d");
 $order = $_GET['order'];
 $section_id = $_GET['section_id'];
 mysql_query(" UPDATE  d_o_sp_orders  SET status='0' 
WHERE section_id='$section_id'");
		
mysql_query(" INSERT INTO  table (`order_id`, `orders`,
 `section_id`, `status`, `status_timestamp`) VALUES 
(NULL, ' $order', '$section_id', '1', '$timestamp_complete')");

------------------------------------------------------------------------------------------------------------
                                                   

0 comments:

Post a Comment

Hi to all Visitors,
Feel free to Comment Here.
Your Feedback or suggestion will be appreciated.