Jump to content

Search the Community

Showing results for tags 'ajax'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Categories

There are no results to display.


Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 85 results

  1. Pretty new to processwire and really enjoying it so far. I'm trying to build a pretty simple Ajax driven website (pretty new to me so excuse my general ignorance regarding ajax) which inserts content from child pages into a parent page. I've read through Ryan's thread here which was super helpful, but still can't quite figure out the best practices for what I'm trying to achieve. For now, all I'm trying to do is have the parent page load content from a child page with an ajax request, BUT these child pages also need to be inaccessible via the URL processwire creates for them. So the child pages are hidden via their template's access options. The /parent/ page successfully loads some initial content from these child pages using the "include=all" selector ( $pages->get("/parent/")->children('include=all'); ) as recommended in this thread. However as the child pages are hidden any ajax request to pull data from them results in a 404. If anyone can suggest the best practices for using processwire to create a site like this it would be a huge help. I assume that later I may have issues with linking/indexing by using this approach, but am happy to figure those out later.
  2. Hi ! I trying to send a "Participant form" that should be a bit dynamic. Very simplified the form looks like this Club info Participant NAME etc [ + add one more ] Photo of receipt [submit] My problem is how to use wireupload with data sent by JavaScript. I get as far as the upload path... but at $u = new WireUpload(XXX); I'm totally in the dark which info the xxx should bee when sent as JavaScript. ? My goal is to populate the field $item->f_receipt with the photo. (Right now im working locally... hope that don't cause problem) var_dump($_FILES); looks like this so im sending something to my process page: array(1) { ["f_receipt"]=> array(5) { ["name"]=> string(22) "121010-111847AM_m7.jpg" ["type"]=> string(10) "image/jpeg" ["tmp_name"]=> string(36) "/Applications/MAMP/tmp/php/phppJGcSh" ["error"]=> int(0) ["size"]=> int(50846) }} I have been reading around at the forum for two nights but im to novice to get it. Copying code from http://processwire.com/talk/topic/1809-image-upload-via-wireupload/ http://processwire.com/talk/topic/3105-create-pages-with-file-upload-field-via-api/page-3 this is my code: All tips in the right direction will very welcome. function addPage($ordernumber, $name, $enamn, $gender, $weight, $cardnumber, $club, $trainer, $epost, $telefon, $message, $receipt,$_parent ){ $item = new Page(); // create new page object $item -> template = 'competition_form_person'; // set template $item -> parent = $_parent; $p -> name = uniqid($name . '_' . $enamn); $item -> title = $_REQUEST['f_ordernumber'] .'_' . $name . '_' . $enamn . '_' . $weight; $item -> save(); $item -> f_ordernumber = $ordernumber; $item -> f_name = $name; $item -> f_ename = $enamn; $item -> f_gender = $gender; $item -> f_weight = $weight; $item -> f_kampsportskort = $cardnumber; $item -> f_club = $club; $item -> f_trainer = $trainer; $item -> f_epost = $epost; $item -> f_telefon = $telefon; $item -> f_message = $message; $item -> save(); $upload_path = $page->config->paths->root . 'tmp_uploads/'; echo '$upload_path---------------------------->' . $upload_path; // RC: create temp path if it isn't there already if(!is_dir($upload_path)) { if(!wireMkdir($upload_path)) throw new WireException("No upload path"); } if(empty($_FILES[$req]['name'][0])){ $errors[$req] = "Select files to upload."; } // setup new wire upload $u = new WireUpload($receipt);/// $receipt['name'] $_FILES $u->setMaxFiles(1); $u->setOverwrite(false); $u->setDestinationPath($upload_path); $u->setValidExtensions(array('jpg', 'jpeg', 'png', 'gif')); foreach($u->execute() as $filename) $item->f_receipt -> add($filename); $item -> save(); } The JS sending info oData = new FormData(document.forms.namedItem("form_competition")); var receipt = document.getElementById('f_receipt'); var file = receipt.files[0]; oData.append('f_ordernumber', postJSON.f_ordernumber); oData.append('f_trainer', postJSON.f_trainer); oData.append('f_epost', postJSON.f_epost); oData.append('f_telefon', postJSON.f_telefon); oData.append('f_receipt', file); oData.append('f_message', postJSON.f_message); oData.append('fighters', JSON.stringify(postJSON.fighters)); /*make the ajax call*/ $.ajax({ url: "/slagskeppet_test/ProcessWire-master/call_competition_form/", type: "POST", data: oData, contentType: false, processData: false, success: function(msg){ alert(msg); }, error: function() { alert("failure"); } }); /Erik
  3. Hello everyone, I was just asking myself whether any has already created some kind of ajax file upload in Processwire for a page that is not yet created. As a simple example, think of a user registration form with the usual fields including an avatar image. I'd like to use something like Plupload, Dropzone.js or a similiar Ajax file uploader to upload the file asynchronously already before the rest of the form is processed. That would make it possible to i.e. directly show the user a resized preview of his avatar image, build forms with a lot of file uploads that would otherwise break the file upload limit, and probably a lot more neat features. It would be essential, that it is usable like a standard backend file upload/image field afterwards, it would be even better if files are also located in the id-named folder in assets/ after submitting the leftover form. The way I thought about how to do this would pack the following functionality in a plugin: Use some existing Ajax file uploader to get the file from client to server. There, a module takes care of the request, saves the file to some temporary folder and answers with an (id) reference to the image to work with it later. Ideally - if it's an image - it would already be possible to get a resized version of the image to provide a live preview. When the form finally get's submitted, the request includes the reference to the file. On the server, the image field is constructed as usual and the file itself get's moved to the "default" location. The temporary reference is deleted. One problem I see with this approach, is that after a while you will have a lot of unused files and references but that's no problem that a cron job with some code to get rid of old stuff couldn't solve. Having written all that down: Is there anything that already solves more or less what I described? And if not: do you see any problems with my outline or do you have a more elegant idea to implement this? Any feedback on this is appreciated, for sure. Marc
  4. LeiHa

    ajax data

    Hello forum, I'm here to get a help again. This time, I'm having a trouble with ajax data. Sending a data into the same page seems okay. However, Sending a data into the different page seems not working. I don't know why. Here is the jquery code. $.ajax({ url: url, type: 'POST', data: { from: 'thispage' }, success: function(data){ alert(data); } }); If url is './' I can get this value from $input->post->from This value returns 'thispage' as expected. If url is '/different/page' I won't get this value from the above $input->post->from It seems url has to be a file, Processwire template and page created somehow. Otherwise, it won't be processed because of permission issue. So, I created template and a hidden page just for the processing ajax. Any idea what would be wrong? Thanks.
  5. Hi all, I'm actually try to handle some mixed sort of adaptive and responsive image display in a gallery. That means I want to serve one out of three or four image-length that best fit to the current client-device-viewport, (to avoid sending 1600x1200 images to smartphones). The plan is as follows: The first page displays only thumbnails, so with them there is only one length. When the thumbnail page is loaded, it should send the actual viewport dimensions to PW. Dimensions get stored in session. Image-src is linked to /img/ID/, /img/ is a PW php script that compare last stored viewport dimensions against the width-height of desired image and send that one that fits best. As I have half of that already running long time on my old website (but with prototype and scriptaculous) I think I can solve that with jquery too. But with browser compatibility and all that stuff I'm feeling pretty much uncomfortable, so I want to ask if the following JS-code is bullet proof and also up to date for my needs or if I should use something different these days: function sendViewportDimensions() { // some jquery-ajax code } document.observe('dom:loaded', function() { sendViewportDimensions(); Event.observe(document.onresize ? document : window, "resize", function() { sendViewportDimensions(); }); }); And second question is if I have to add some kind of session-id to the ajax-request or if that is send automatically with it, or if it is send only sometimes automatically and sometimes not? (and I better have to add it to be save) ??
  6. Has anyone implemented the jQuery version of Paul Irish's Infinite Scroll script on a site built with ProcessWire? If so, I'm interested in reading about your experience and tips on how you implemented it. https://github.com/paulirish/infinite-scroll
  7. SOLVED Hello people! This is my first post at the processwire forum. There is something i can't figure out. The best way to explain my problem is to go to the following website: followmylegends.com. When you try to register a small pop-up is coming. Now my question is how can I fill the pop-up with content with jquery? ($.get, or AJAX) When i try something like this it wont work. $('#register, #forgot').click(function(e){ var div = $(this); e.preventDefault(); $.get($(this).attr('href'), function(data) { $('#'+$(div).attr('data-reveal-id')).html(data); }); }); Then I get an error: GET http://www.followmylegends.com/site/templates/register/register.php 404 (Page Not Found) But the file is in templates/register/register.php. Can somebody help me? Thx, John Update Sorry for this topic.. This was a bit timewasting like 3 hours. I have to learn more about processwire. What I did was create a new template. Use it for a page and called it with url.com/register/ Sorry again..
  8. Hi, Is there a build in way in Processwire to load pages through with ajax-requests? I would like to load a homepage with header and footer included and after that only the body of the next pages. Then, only with the first load, jquery, other javascript and css has to be loaded. Thanks
  9. Hi, I'm gonna try and build an ajax powered comments system and was planning to build the whole thing on a one comment == one page basis. The comment page having a textfield for the actual comment, a page field with the user page of the commenter (it will require registration) and a page field for the page that was commented on. Since Ryan's comments module uses simple DB entries I was wondering if this is a good plan and what the benefits of not having one page per comment are? Will I experience problems if a million people comment stuff on my site? Thanks for hints an ideas! thomas
  10. Hello, since I almost finished my first processwire project I am somewhat tempted to rebuild other sites that need a relaunch anyway. One of which is a video site where selected people can upload videos which are transcoded on the server into different formats (m4v,webm). This site is build in symfony 1.4 and since every little change always takes me ages to commit, I would very much like to rebuild in PW. One of my first questions for this project is if the inputfieldFile Ajax upload would be suitable for large video uploads up to 1GB or if I should rather use SWFUpload like the old site does ...? Does anyone here have any experience with those kind of uploads? Thanks, thomas
×
×
  • Create New...