Jump to content

unplugged_web

Members
  • Content Count

    897
  • Joined

  • Last visited

Community Reputation

2 Neutral

About unplugged_web

  • Rank
    Invested Member
  1. I changed the code to this: var $buttonID = $j(this).attr('id'); $buttonID = $buttonID.replace("change","data"); console.log($buttonID); and it now worksde to this: var $buttonID = $j(this).attr('id'); and it now works
  2. How do I change the text of this? I'm getting the id of a button (which works) but when I try to change it the console outputs the buttons value instead. This is what I've got: $j(this).attr('id'); var $buttonID = $j(this).val(); $buttonID = $buttonID.replace("change","data"); console.log($buttonID); if I do this though the alert box shows the buttons id: alert($('.change').attr('id'));
  3. The file was automatically saved from a feed so I wasn't able to change the output. I decided to use a cvs copy of the feed instead as that wasn't changed at all
  4. This is what I've got so far but all I get is errors. This is the code I'm using to get the xml file into the database: <?php$xml = simplexml_load_file('feed.xml');foreach($xml->children() as $product) { mysql_query("INSERT INTO data (name,desc,tracking,brand) VALUES ('$product->text->name','$product->text->desc','$product->uri->Track','$product->brand->brandName')");} ?> and this is the XML file: <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE cafProductFeed SYSTEM "http://www.window.com/DTD/affiliate/datafeed.1.4.dtd"><cafProductFeed><datafeed id="36" merchantId="36" merchantName="Company"><prod id="12345678"> <brand> <brandName>Universal Pictures</brandName> </brand> <cat> <CatId>550</CatId> <Cat>Blu-Ray</Cat> <mCat>Blu-ray</mCat> </cat> <price curr="USD"> <buynow>44.99</buynow> <delivery>1.99</delivery> <store>0.00</store> </price> <text> <name>Product</name> <desc>description text</desc> </text> <uri> <Track>http://www.tracking.com</Track> <Image>http://images.domain.com/</Image> <mImage>http://www.images.domain.com</mImage> <mLink>http://www.domain.com/blu-ray/bourne-identity/the-bourne-supremacy/the-bourne-ultimatum/</mLink> </uri> <vertical/> <pId>1234567</pId> <largeImage>http://large.image.com</largeImage> <ean>1234567</ean></prod><prod id="12345678"> <brand> <brandName>Universal Pictures</brandName> </brand> <cat> <CatId>550</CatId> <Cat>Blu-Ray</Cat> <mCat>Blu-ray</mCat> </cat> <price curr="USD"> <buynow>44.99</buynow> <delivery>1.99</delivery> <store>0.00</store> </price> <text> <name>Product</name> <desc>description text</desc> </text> <uri> <Track>http://www.tracking.com</Track> <Image>http://images.domain.com/</Image> <mImage>http://www.images.domain.com</mImage> <mLink>http://www.domain.com/blu-ray/bourne-identity/the-bourne-supremacy/the-bourne-ultimatum/</mLink> </uri> <vertical/> <pId>1234567</pId> <largeImage>http://large.image.com</largeImage> <ean>1234567</ean></prod></datafeed></cafProductFeed> but all I get is errors: Warning: simplexml_load_file(): http://www.domains.co.uk/feed.xml:1: parser error : Space required after the Public Identifier in /home/domain/parse.php on line 2 Warning: simplexml_load_file(): <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> in /home/domain/parse.php on line 2 Warning: simplexml_load_file(): ^ in /home/domain/parse.php on line 2 Warning: simplexml_load_file(): http://www.domains.co.uk/feed.xml:1: parser error : SystemLiteral " or ' expected in /home/domain/parse.php on line 2 Warning: simplexml_load_file(): <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> in /home/domain/parse.php on line 2 Warning: simplexml_load_file(): ^ in /home/domain/parse.php on line 2 Warning: simplexml_load_file(): http://www.domains.co.uk/feed.xml:1: parser error : SYSTEM or PUBLIC, the URI is missing in /home/domain/parse.php on line 2 Warning: simplexml_load_file(): <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> in /home/domain/parse.php on line 2 Warning: simplexml_load_file(): ^ in /home/domain/parse.php on line 2 Fatal error: Call to a member function children() on a non-object in /home/domain/parse.php on line 3 I've never done anything like this before and would be so grateful for some help please
  5. I'm trying to get the contents of a few xml files (all on the server) into a couple of different tables of a database but don't know how to do this. Does anybody have any ideas? All of the files are the same format wise and I need to put the details into two different tables. Thanks in advance
  6. I've got a link that is sent using AJAX but no results are being sent. The link is: <a href="javascript:void(0);" data-flavour="Berry" class="nav_link Berry">Berry</a> While the AJAX is: <script type="text/javascript"> $('.nav_link').on('click', function(){ event.preventDefault(); var flavour = $(this).data('flavour');$.get('/filter/?search=' + $(flavour).val(),{flavour:flavour}).done(function(data){ if(!$('#container').hasClass('is-loaded')) { $('#container').addClass('is-loaded'); $('#container').html(data);} else { $('#container').append(data);} }); } );</script> When I get the filter page is says the search value is undefined. If I go directly to the page with what should be sent via AJAX (filter/?search=Berry) then I get all of the relevant results I don't get any errors at all either
  7. I've added this to a site I'm working on but want the card type to be included when the form is submitted but don't know how to update the input value when the card number is entered. At the moment I've got a span class which shows the card image (done using the above example) and then the user has to select their payment method before the form will send. How do I change it so that the type is added to a hidden text field?
  8. Yep coincidence I agree but I can assure you that it's not me, although you're right I used to work for a company in High Road (how did you know that one!!) although I'm no longer in London now
  9. Thanks, I'll give that a go!
  10. Probably a dumb question but how would I do that? Nah that's not me
  11. Sorry I don't understand what you mean?
  12. Essentially what I've got is a page of comments. Only ten of them are loaded. People can click to say if a comment was helpful or not. This works okay but after more comments are loaded (which are being loaded by using the code below) the code to give feedback stops working. All of the comments are being loaded dynamically so I've given the button a class rather than an id. The code to count the feedback in below where all of the comments are but all except the first ten comments are loaded but the user doing something after the page has loaded <script type="text/javascript"> var comments_offset=<?php echo $more ?>; function comments_load() { $.ajax({ url: "/more-comments.php?pid=<?php echo $id ?>&offset="+ comments_offset+"&t="+Math.random(), success: function(data){ if( data.substring( 0,5 )!="failed" ) { bits=data.split( "==DSPLIT==" ); $(bits[1]).insertBefore( "#comments-control" ); comments_offset=bits[0]; if( reviews_offset==0 ) { $("#comments-control").hide(); } } } }); } </script>
  13. I tried to use it like this: <script type="text/javascript">var newElement = $(bits[1]);newElement.click(function() {$(".rate-yes").click(function(e) { // "this" here corresponds to the button that was clicked var self = this; $.ajax({ async: false, type: "POST",url: "rate.php?rate=good&id=" + $(self).val(), data: $(self).serialize(), // self instead of the class success: function(data) { $('#helpful' + $(self).val()).fadeOut("fast", function() { $(this).before("<div class='rate'>Was this comment helpful? <span style='color: #33cc33;'>✓ Thank you for your feedback</span></div>"); }); } });}); $(".rate-no").click(function(e) { // "this" here corresponds to the button that was clicked var self = this; $.ajax({ async: false, type: "POST",url: "rate?rate=bad&id=" + $(self).val(), data: $(self).serialize(), // self instead of the class success: function(data) { $('#helpful' + $(self).val()).fadeOut("fast", function() { $(this).before("<div class='rate'>Was this comment helpful? <span style='color: #33cc33;'>✓ Thank you for your feedback</span></div>"); }); } });});});newElement.insertBefore( "#comments-control" );</script> but then none of it worked. Have I done something wrong?
  14. I'm really sorry but I don't understand what I should do? Should I use .live() or newElements?
  15. I have two pieces of code, one loads more comments and the other sends feedback. Both of the calls use AJAX and work separately but they don't work together. The code I've got is: <script type="text/javascript"> var comments_offset=<?php echo $more ?>; function comments_load() { $.ajax({ url: "/comments.php?pid=<?php echo $id ?>&offset="+comments_offset+"&t="+Math.random(), success: function(data){ if( data.substring( 0,5 )!="failed" ) { bits=data.split( "==DSPLIT==" ); $(bits[1]).insertBefore( "#comments-control" ); comments _offset=bits[0]; if( comments_offset==0 ) { $("#comments-control").hide(); } } } }); } </script> <div id="comments-control" <?php if( !$more ) { ?> style="display: none;"<?php } ?>> <br /><a class="input_button" onclick="reviews_load();" href="javascript:void(0);" style="padding: 10px; height: auto; background-color: #000; border: 1px solid white; color: #fff;">Laod more comments </a> </div> Which loads more comments And this which registers feedback for the comments. It works great for the first ten comments but when I use the other code to load more it then stops working <script type="text/javascript">$(".rate-yes").click(function(e) { // "this" here corresponds to the button that was clicked var self = this; $.ajax({ async: false, type: "POST",url: "/rate.php?rate=good&id=" + $(self).val(), data: $(self).serialize(), // self instead of the class success: function(data) { $('#helpful' + $(self).val()).fadeOut("fast", function() { $(this).before("<div class='rate'>Was this comment helpful? <span style='color: #33cc33;'>✓ Thank you for your feedback</span></div>"); }); } });}); $(".rate-no").click(function(e) { // "this" here corresponds to the button that was clicked var self = this; $.ajax({ async: false, type: "POST",url: "/rate.php?rate=bad&id=" + $(self).val(), data: $(self).serialize(), // self instead of the class success: function(data) { $('#helpful' + $(self).val()).fadeOut("fast", function() { $(this).before("<div class='rate'>Was this comment helpful? <span style='color: #33cc33;'>✓ Thank you for your feedback</span></div>"); }); } });});</script> I've tried to use $(".rate-yes").on("click",function(e) { and $(".rate-no").on("click",function(e) { instead but that doesn't work either
×
×
  • Create New...