Posts

How to pass parameters to controller using ajax and javascript? -

i trying delete item shopping cart using ajax javascript, have trouble passing parameters controller. parameters null in controller. my javascript code shows below: function removerow(itemid, rowid){ if (xmlhttp == null) { alert("your browser not support ajax!"); return; } var query = "action=remove&item=" + itemid; /* alert(query); */ xmlhttp.onreadystatechange = function statechanged() { if (xmlhttp.readystate == 4) { var row = document.getelementbyid(rowid); row.parentnode.removechild(row); } }; xmlhttp.open("get", "addto.htm", true); xmlhttp.setrequestheader("content-type", "application/x-www-form-urlencoded"); xmlhttp.send(query); return false; /* var row = document.getelementbyid(rowid); row.parentnode.remo...

mysql - Conditional Sorting of Data using php codes from sql database -

Image
i'm having problem sort table values different categories of books , i'm having 10 categories of books. categories mentioned in table entitled "categories" (1, 2, 3,...10) , each category contains more 100 books. i want sort books 1 category such 1 database , ignore other categories. used following php codes sorted results whole of column "categories" means categories sorted 1 one want sort data single category. $orderby = "order books.category desc"; $addparam = ""; if ($_get["incldead"] == 2) $wherea[] = "visible = 'yes'"; $res = mysql_query("select count(*) books $where") or die(mysql_error()); $row = mysql_fetch_array($res,mysql_num); $count = $row[0]; if ($count) { $pager = pager($booksperpage, $count, "browse.php?" . $addparam); $query = "select books.id, books.category, books.name, books.times_completed, books.size, books.added, books.type, books.comments,books...

swing - Multiple screen java applet has buttons that don't work -

i'm making program has 2 screens, title , game screen. if user clicks "play", can proceed next screen. however, on next screen if user tries press button "keep going", nothing happens. want know why , if can fix it. thanks, , here code: import java.applet.*; import java.awt.*; import javax.swing.*; import java.awt.event.*; public class zombiedice extends applet implements actionlistener { panel p_card; panel card1, card2; cardlayout cdlayout = new cardlayout (); int shotguns = 0; int brains = 0; int p1b = 0; int p2b = 0; jlabel pic1; jlabel pic2; jlabel pic3; public void init () { p_card = new panel (); p_card.setlayout (cdlayout); screen1 (); screen2 (); resize (600, 500); setlayout (new borderlayout ()); add ("center", p_card); } public void screen1 () { card1 = new panel (); jlabel logo = new jlabel (createimageicon ("logo.jpg")); jbutton play = new jbutton (createimageicon ("play.j...

rest - Can't Get Post Data Codeigniter -

i tried make rest api android app using codeigniter, first don't have trouble using method, parameter data can sent. when came post method, rest api can't header. solution great. thanks here url using method: http://10.34.1.122/a-kit-android/api/cont_a_kit/start_mesin_operasi?id_mesin=10&operasi=1 here url using post method: http://10.34.1.122/a-kit-android/api/cont_a_kit/start_mesin_operasi header : id_mesin = 10, operasi=1 here controller: function start_mesin_operasi() { $idmesin = $this->input->post("id_mesin"); $data = array( 'operasi' => $this->input->post("operasi"), ); header('content-type: application/json'); echo 'id mesin: '.$idmesin; echo json_encode($this->mod_a_kit->start_mesin($idmesin, $data)); } and here model: function start_mesin($id, $data) { $thi...

javascript - bitwise OR unexpected result -

this line of code: console.log((90000000000000|0).tostring()); output: -1039687680 ( bin -111101111110000110000000000000 ) according 32-bit signed integer conversion , expect: /--discarded--\/---------significant----------\ 10100011101101011000010000001111010000000000000 = 90000000000000 │ 11000010000001111010000000000000 or 00000000000000000000000000000000 ================================ 11000010000001111010000000000000 = -1107795968 sign/\------significant bits-------/ why obtain -1039687680 instead of -1107795968 ? as mentioned in post linked, it's in two's complement format. negative 11000010000001111010000000000000 xor 1 plus 1 equals positive 11110111111000011000000000000000, 1039687680 finally -1039687680 gained.

javascript - Jquery Children's child elemnt -

$(parentquestion.children('.choice_class:last')); <div class='parentquestion'> ..... <div class="choice_class"> <div class="form-group"> <label class="control-label col-md-3 col-sm-3 col-xs-12"><span class="choice-no">option 1</span><span class="required">*</span> </label> <div class="col-md-6 col-sm-6 col-xs-12"> <input type="text" required="required" class="form-control col-md-7 col-xs-12"> </div> <a href="javascript: void(0);" onclick="addoption(this)" class="btn btn-danger"><span class="glyphicon glyphicon-plus"></span>add choice</a> </div> </div> inside addoption function, using variable, found p...

android - Fail to Move a View to a TableRow -

i trying inflate layout resource , move views in table. remove views parents , add them table. works need add them tablerow in table instead. however, when tried that, nothing showed up. to simplify example, use views in xml instead of ones generated in code. in following xml, there tablelayout 1 tablerow , imagebutton: <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" ...> <tablelayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/table"> <tablerow android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/row_1"></tablerow> </tablelayout> <button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="new button" an...