dynamic pages with php

  • (2 Pages)
  • +
  • 1
  • 2

23 Replies - 810 Views - Last Post: 28 December 2013 - 10:28 AM

#16 ge∅  Icon User is online

  • D.I.C Regular

Reputation: 59
  • View blog
  • Posts: 440
  • Joined: 21-November 13

Re: dynamic pages with php

Posted 30 November 2013 - 11:47 AM

I could have called it ajax() or kittykittyohmykittykittyIlikeitwhenyoupurr(). it just makes sense to call it POST as it sends a HTTP POST request.
Was This Post Helpful? 0
  • +
  • -

#17 Atli  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3712
  • View blog
  • Posts: 5,964
  • Joined: 08-June 10

Re: dynamic pages with php

Posted 30 November 2013 - 03:04 PM

View Postge∅, on 30 November 2013 - 06:10 PM, said:

You don't need jQuery just for function that can fit in 15 lines.

I wouldn't dismiss it that easily though. It does come with some nice things that you won't easily replicate in that few a lines, especially if you are anything less than an expert with Javascript and AJAX. Legacy browser compatibility, and easy support for JSON come to mind. - On top of that, having jQuery is very handy all over. The event handling improvements alone are well worth it.

View Postwakinews, on 30 November 2013 - 06:38 PM, said:

the POST i know how to use is the one we use in forms i.e POST=(page.php)

You mean action="page.php". The POST is the value for the method attribute. - And in a sense, it is the exact same thing in this context. What ge∅ demonstrated there was how you would do a POST request in AJAX, just like you would do a POST request through a <form>.
Was This Post Helpful? 0
  • +
  • -

#18 wakinews  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 72
  • Joined: 10-November 13

Re: dynamic pages with php

Posted 30 November 2013 - 03:28 PM

Yes i meant the method =post. not so comfortable with AJAX at the moment . At the moment I am trying to separate my code using the MVC design pattern then i will try to do design part
Was This Post Helpful? 0
  • +
  • -

#19 ge∅  Icon User is online

  • D.I.C Regular

Reputation: 59
  • View blog
  • Posts: 440
  • Joined: 21-November 13

Re: dynamic pages with php

Posted 30 November 2013 - 06:03 PM

Yes, it's exactly the same thing, a POST HTTP request. The only difference is that you are not redirected. The server response is sent to the responseText property of the xhr object (my serverResponse variable in the example)

Atli, I totally agree with the fact that jQuery might be useful to some people. But we are talking about AJAX : the standard syntax of the XMLHTTPRequest object is compatible with Internet Explorer 7 (which has only 3 or 5% usage share anyway) and the encodeURIComponent is compatible with Internet Explorer 6. That's more than enough. If you want to add the following snipet for IE 5 and 6 it's up to you but event Google doesn't support IE6 any more.

if (window.ActiveXObject){
   try {xhr = new ActiveXObject("Msxml2.XMLHTTP");}
   catch(e) {xhr = new ActiveXObject("Microsoft.XMLHTTP");}
}


OK, I agree that the very usefull JSON.parse and JSON.stringify methods are only compatible with Internet Explorer 8, but a 50 lines polyfill is faster to download than an entire library (and you don't always need JSON - in this case you don't)

I am not campaigning against jQuery (even though I love to do it) but I don't understand this idea that AJAX = jQuery. AJAX is not complicated, it doesn't require a library
Was This Post Helpful? 0
  • +
  • -

#20 Atli  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3712
  • View blog
  • Posts: 5,964
  • Joined: 08-June 10

Re: dynamic pages with php

Posted 30 November 2013 - 07:12 PM

View Postge∅, on 01 December 2013 - 01:03 AM, said:

I am not campaigning against jQuery

You're not? Could have fooled me :)

View Postge∅, on 01 December 2013 - 01:03 AM, said:

the standard syntax of the XMLHTTPRequest object is compatible with Internet Explorer 7 (which has only 3 or 5% usage share anyway) and the encodeURIComponent is compatible with Internet Explorer 6. That's more than enough.

That is debatable, and depends highly on the situation. Everything from the target region, the intended audience, and the type of website you are building factors into deciding what legacy browser support is required. For instance, for an international company, the global ~5% usage share of IE6 is far to great a number of visitors to lose, when adding support for it costs nothing more than to use jQuery instead of plain Javascript.

Nobody here was suggesting that jQuery is required for AJAX, but there is a very good reason why jQuery is so popular, and it's easy to use AJAX shortcuts are the least of that reason.
Was This Post Helpful? 0
  • +
  • -

#21 julyphan  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 28-December 13

Re: dynamic pages with php

Posted 28 December 2013 - 01:34 AM

Did you try disqus ? It's very easy.
Was This Post Helpful? 0
  • +
  • -

#22 wakinews  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 72
  • Joined: 10-November 13

Re: dynamic pages with php

Posted 28 December 2013 - 02:13 AM

whats disqus?
Was This Post Helpful? 0
  • +
  • -

#23 julyphan  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 28-December 13

Re: dynamic pages with php

Posted 28 December 2013 - 02:33 AM

Google Search, it's a plugin help you manage user comment in your site. You don't need to create any data table to save comment, don't need to sort. Very easy, just add some script into your html(or jsp) file. I tried to save all users comments to database and it's a big issue when you query all comment for a topic.
Was This Post Helpful? 0
  • +
  • -

#24 wakinews  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 72
  • Joined: 10-November 13

Re: dynamic pages with php

Posted 28 December 2013 - 10:28 AM

@julyphan I have checked disqus out .I had no idea there was such a thing. It looks cool and I am still discovering it. Will see how it can integrate with my application. Thanks alot for the information. cheers

happy new year!!!
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2