Jump to content

w3schoon

Members
  • Content Count

    50
  • Joined

  • Last visited

Community Reputation

0 Neutral

About w3schoon

  • Rank
    Newbie
  1. Nice be with you everyone! What is the main difference between If else and Shorthand If? Example: If ($gender == 'male') echo 'Hi Sir!'; else echo 'Hi Mam!'; and ($gender == 'male') ? echo 'Hi Sir!' : echo 'Hi Mam!'; Thank you in advance!
  2. Nice be with you everyone! I'm a beginner in CodeIgniter framework and I'm really interested to explore its classes, methods, properties, etc... May I know what is the usage of CI_Controller, load, helper, library, form,_validation, run & view ? I found these here... <?phpclass Form extends CI_Controller {function index(){ $this->load->helper(array('form', 'url')); $this->load->library('form_validation'); if ($this->form_validation->run() == FALSE) { $this->load->view('myform'); } else { $this->load->view('formsuccess'); }}}?> Thanks in advance!
  3. Nice be with you everyone! May I now what's the purpose of <html lang="en"> ? Thank you in advance!
  4. Thanks a lot guys. Good explanations, I got what you mean. Now I know the usage data: in Ajax...
  5. What do you mean JSG? Till now I don't understand what the usage of ajax=1 when it pass to the path i.e. url
  6. Nice be with you everyone! Question:1. How to select multiple id's or elements with hover?I want to simplify this, // CSS or JQuery Selector#id:hover, #name:hover, #age:hover{ } to this one, (#id, #name, #age):hover{ // I know this is wrong selector but is there any way to select like this one for optimisation?} Thank you in advance!
  7. @thescientist: Wow you're right, instead of includes/delete.php I misspelled the path to javascripts/delete.php. Thank you for the correction, now my $.ajax() is running successfully but the problem is: Why the selected database was not deleted after $.ajax() ran successfully? @justsomeguy: Oh I see, in your link. I learned that my client was able to communicate with the server, but the problem is the server could not find what was requested. Can you look at my PHP request? Here's my code: <?php // This is includes/delete.php include "mysqlCon.php"; if (isset($_GET['delete'])){ $query="DELETE FROM applicants WHERE id=".(int)$_GET['delete']; mysql_query($query); } mysql_close($conServ); ?> Thank you.
  8. Nice be with you everyone! Problem:Every time I click delete (database) button it always trigger 404: and respond "Could not contact server". Questions:1. What is Error 404?2. And how to fix it to run Ajax successfully? Here's my code: var parent=$(this).closest("tr"); $.ajax({ type:'get', url:'javascripts/delete.php', data:'ajax=1&delete='+$(this).attr('id'), statusCode: { 404: function() { $("#alert").html('Could not contact server.'); }, 500: function() { $("#alert").html('A server-side error has occurred.'); } }, error: function() { $("#alert").html('A problem has occurred.'); }, success:function(){ $("#alert").html('Successful!'); parent.fadeOut(300, function(){ parent.remove(); }); } }); Thank you!
  9. Thank you very much, now I understand. How about ajax=2 or 3 or 4 or n... ?
  10. Nice be with you everyone! I'm planing to use JQuery $.ajax() method to delete 1 row of my database. While searching I found this on the web... $.ajax({ type: 'get', url: '/examples/delete.php', data: 'ajax=1&delete=' + $(this).attr('id'), success: function() { parent.fadeOut(300,function() { parent.remove(); }); } }); I have questions: 1. What is the difference of post & get in the type: ?2. What is the usage of 'ajax=1&delete=' in the data: ?3. If there is success: how about if not success, I mean error handler? Thank you.
  11. Can you give more idea or any codes?
  12. Thank you for the reply! Finally by experimentation I solved the problem on how to put JQuery inside JavaScript Protoype What am I trying to do is to make a Javasscript prototype that maximums number of characters allowed in the <input> element using maxlength. To simplify my code I decided to use attr() method, unfortunately It didn't work, but blessedly by trial and error I found out that my problem is simple. Use "String.prototype" if your constructor is for String e.g. length(), replace(), etc. Use "Object.prototype" if your constructor is for Object e.g. attr() etc. Here's my code and it's working! Try it yourself >> <!DOCTYPE html> <html> <head> <title>Applicant Tracking Database System</title> <script type="text/javascript" src="javascripts/jquery-1.9.1.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ Object.prototype.maxlength=function(a){ this.attr("maxlength",a); }; $("#name").maxlength(10); }); </script> </head> <body> <p>Name: <input id="name" type="text" name="name"></p> </body></html> Thank you!
  13. Nice be with you everyone! I found out that input required attribute requires "that an input field must be filled out before submitting the form." like this... <form action="demo_form.asp">Username: <input type="text" name="usrname" required><input type="submit"></form> My question is: Is it possible also to use input required attribute in select? like this... <select name="gender" required><option value="" selected="selected">Choose...</option><option value="male">Male</option><option value="female">Female</option></select> I want to validate gender field if it has already value (male or female)otherwise will not submit like what input required attribute can do Thank you.
×
×
  • Create New...